From 880225db77cddaa43174388768b81e361e9e99d6 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 12 Nov 2011 22:22:00 +0000 Subject: [PATCH 001/203] OpenCL/Nvidia: * Enable OpenCL Full Shading on NVIDIA cards. Notes: It makes not much sense to use OpenCL on a nVidia card (as it is slower compared to CUDA), but as OpenCL comes without dependencies, it's an good alternative if you don't want to install the CUDA toolkit or the build comes without CUDA kernels. --- intern/cycles/device/device_opencl.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index d8df8025a08..c96d4617ffb 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -177,6 +177,7 @@ public: bool opencl_version_check() { char version[256]; + int major, minor, req_major = 1, req_minor = 1; clGetPlatformInfo(cpPlatform, CL_PLATFORM_VERSION, sizeof(version), &version, NULL); @@ -265,6 +266,20 @@ public: build_options += "-I " + kernel_path + ""; /* todo: escape path */ build_options += " -cl-fast-relaxed-math "; + + /* Full Shading only on NVIDIA cards at the moment */ + char vendor[256]; + + clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), &vendor, NULL); + string name = vendor; + + if (name == "NVIDIA CUDA") { + build_options += "-D __SVM__ "; + build_options += "-D __EMISSION__ "; + build_options += "-D __TEXTURES__ "; + build_options += "-D __HOLDOUT__ "; + build_options += "-D __MULTI_CLOSURE__ "; + } ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL); From 72a7101576dc54f6608fda8a0def19db20d10f44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 09:20:04 +0000 Subject: [PATCH 002/203] include invalid type name in mathutils error messages. --- .../python/mathutils/mathutils_Color.c | 42 +++++++++++-------- .../python/mathutils/mathutils_Matrix.c | 15 ++++--- .../python/mathutils/mathutils_Quaternion.c | 14 ++++--- .../python/mathutils/mathutils_Vector.c | 35 +++++++++------- 4 files changed, 61 insertions(+), 45 deletions(-) diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index c374d0eb73d..3e7aeef3044 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -370,9 +370,10 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2) float col[COLOR_SIZE]; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -392,9 +393,10 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2) ColorObject *color1 = NULL, *color2 = NULL; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color addition: (%s += %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -417,9 +419,10 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2) float col[COLOR_SIZE]; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -439,9 +442,10 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2) ColorObject *color1= NULL, *color2= NULL; if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { - PyErr_SetString(PyExc_TypeError, - "Color subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Color subtraction: (%s -= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } color1 = (ColorObject*)v1; @@ -554,9 +558,10 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2) mul_vn_fl(color->col, COLOR_SIZE, scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Color multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Color multiplication: (%s *= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } @@ -585,9 +590,10 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2) mul_vn_fl(color->col, COLOR_SIZE, 1.0f / scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Color multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Color division: (%s /= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 980dbd17a96..293a960e0a6 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1489,9 +1489,10 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2) mat2 = (MatrixObject*)m2; if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { - PyErr_SetString(PyExc_TypeError, - "Matrix addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Matrix addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name); return NULL; } @@ -1520,9 +1521,11 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) mat2 = (MatrixObject*)m2; if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { - PyErr_SetString(PyExc_TypeError, - "Matrix addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Matrix subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name + ); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 51ab5b50919..a8585f386d5 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -707,9 +707,10 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) QuaternionObject *quat1 = NULL, *quat2 = NULL; if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { - PyErr_SetString(PyExc_TypeError, - "Quaternion addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Quaternion addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name); return NULL; } quat1 = (QuaternionObject*)q1; @@ -730,9 +731,10 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) QuaternionObject *quat1 = NULL, *quat2 = NULL; if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { - PyErr_SetString(PyExc_TypeError, - "Quaternion addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_TypeError, + "Quaternion subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name); return NULL; } diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index ba7cf604c42..66dda6a9623 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -953,9 +953,10 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2) float vec[MAX_DIMENSIONS]; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector addition: (%s + %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -983,9 +984,10 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2) VectorObject *vec1 = NULL, *vec2 = NULL; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector addition: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector addition: (%s += %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1015,9 +1017,10 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2) float vec[MAX_DIMENSIONS]; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector subtraction: (%s - %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1044,9 +1047,10 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2) VectorObject *vec1= NULL, *vec2= NULL; if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) { - PyErr_SetString(PyExc_AttributeError, - "Vector subtraction: " - "arguments not valid for this operation"); + PyErr_Format(PyExc_AttributeError, + "Vector subtraction: (%s -= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } vec1 = (VectorObject*)v1; @@ -1281,9 +1285,10 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) mul_vn_fl(vec->vec, vec->size, scalar); } else { - PyErr_SetString(PyExc_TypeError, - "Vector multiplication: " - "arguments not acceptable for this operation"); + PyErr_Format(PyExc_TypeError, + "Vector multiplication: (%s *= %s) " + "invalid type for this operation", + Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); return NULL; } From 963e39e417c654602bde7c0e8e8ff522478a1ac3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 09:38:53 +0000 Subject: [PATCH 003/203] formatting edits only - no functional changes --- .../python/mathutils/mathutils_geometry.c | 232 ++++++++++++------ 1 file changed, 154 insertions(+), 78 deletions(-) diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index a0a6ba277cf..c2487db707c 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -85,7 +85,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* float det, inv_det, u, v, t; int clip= 1; - if (!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) { + if (!PyArg_ParseTuple(args, + "O!O!O!O!O!|i:intersect_ray_tri", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &ray, + &vector_Type, &ray_off, &clip)) + { return NULL; } if (vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) { @@ -94,8 +101,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(ray) == -1 || BaseMath_ReadCallback(ray_off) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(ray) == -1 || + BaseMath_ReadCallback(ray_off) == -1) + { return NULL; + } copy_v3_v3(v1, vec1->vec); copy_v3_v3(v2, vec2->vec); @@ -173,17 +186,28 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject VectorObject *vec1, *vec2, *vec3, *vec4; float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3]; - if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &vec4)) + { return NULL; } + if (vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) + { return NULL; + } if (vec1->size == 3 || vec1->size == 2) { int result; @@ -257,9 +281,14 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) float n[3]; if (PyTuple_GET_SIZE(args) == 3) { - if (!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (!PyArg_ParseTuple(args, "O!O!O!:normal", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3)) + { return NULL; } + if (vec1->size != vec2->size || vec1->size != vec3->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); @@ -271,13 +300,22 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) + { return NULL; + } normal_tri_v3(n, vec1->vec, vec2->vec, vec3->vec); } else { - if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3, + &vector_Type, &vec4)) + { return NULL; } if (vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) { @@ -291,8 +329,13 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1 || + BaseMath_ReadCallback(vec4) == -1) + { return NULL; + } normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec); } @@ -319,7 +362,11 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; - if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", + &vector_Type, &vec1, + &vector_Type, &vec2, + &vector_Type, &vec3)) + { return NULL; } @@ -329,8 +376,12 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) return NULL; } - if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if ( BaseMath_ReadCallback(vec1) == -1 || + BaseMath_ReadCallback(vec2) == -1 || + BaseMath_ReadCallback(vec3) == -1) + { return NULL; + } if (vec1->size == 3) { return PyFloat_FromDouble(area_tri_v3(vec1->vec, vec2->vec, vec3->vec)); @@ -367,16 +418,21 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float vi[2]; if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d", - &vector_Type, &line_a1, - &vector_Type, &line_a2, - &vector_Type, &line_b1, - &vector_Type, &line_b2) - ) { + &vector_Type, &line_a1, + &vector_Type, &line_a2, + &vector_Type, &line_b1, + &vector_Type, &line_b2)) + { return NULL; } - if (BaseMath_ReadCallback(line_a1) == -1 || BaseMath_ReadCallback(line_a2) == -1 || BaseMath_ReadCallback(line_b1) == -1 || BaseMath_ReadCallback(line_b2) == -1) + if ( BaseMath_ReadCallback(line_a1) == -1 || + BaseMath_ReadCallback(line_a2) == -1 || + BaseMath_ReadCallback(line_b1) == -1 || + BaseMath_ReadCallback(line_b2) == -1) + { return NULL; + } if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { return newVectorObject(vi, 2, Py_NEW, NULL); @@ -411,20 +467,20 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec int no_flip= 0; float isect[3]; if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &plane_co, - &vector_Type, &plane_no, - &no_flip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &plane_co, + &vector_Type, &plane_no, + &no_flip)) + { return NULL; } if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(plane_co) == -1 || - BaseMath_ReadCallback(plane_no) == -1 - ) { + BaseMath_ReadCallback(plane_no) == -1) + { return NULL; } @@ -471,18 +527,18 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje float isect_b[3]; if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &sphere_co, - &sphere_radius, &clip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &sphere_co, + &sphere_radius, &clip)) + { return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1 - ) { + BaseMath_ReadCallback(sphere_co) == -1) + { return NULL; } @@ -551,18 +607,18 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO float isect_b[3]; if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d", - &vector_Type, &line_a, - &vector_Type, &line_b, - &vector_Type, &sphere_co, - &sphere_radius, &clip) - ) { + &vector_Type, &line_a, + &vector_Type, &line_b, + &vector_Type, &sphere_co, + &sphere_radius, &clip)) + { return NULL; } if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || - BaseMath_ReadCallback(sphere_co) == -1 - ) { + BaseMath_ReadCallback(sphere_co) == -1) + { return NULL; } else { @@ -617,16 +673,20 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec PyObject *ret; if (!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line", - &vector_Type, &pt, - &vector_Type, &line_1, - &vector_Type, &line_2) - ) { + &vector_Type, &pt, + &vector_Type, &line_1, + &vector_Type, &line_2)) + { return NULL; } - - if (BaseMath_ReadCallback(pt) == -1 || BaseMath_ReadCallback(line_1) == -1 || BaseMath_ReadCallback(line_2) == -1) + + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(line_1) == -1 || + BaseMath_ReadCallback(line_2) == -1) + { return NULL; - + } + /* accept 2d verts */ if (pt->size==3) { copy_v3_v3(pt_in, pt->vec);} else { pt_in[2]=0.0; copy_v2_v2(pt_in, pt->vec); } @@ -666,17 +726,22 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d", - &vector_Type, &pt_vec, - &vector_Type, &tri_p1, - &vector_Type, &tri_p2, - &vector_Type, &tri_p3) - ) { + &vector_Type, &pt_vec, + &vector_Type, &tri_p1, + &vector_Type, &tri_p2, + &vector_Type, &tri_p3)) + { return NULL; } - if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(tri_p1) == -1 || BaseMath_ReadCallback(tri_p2) == -1 || BaseMath_ReadCallback(tri_p3) == -1) + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(tri_p1) == -1 || + BaseMath_ReadCallback(tri_p2) == -1 || + BaseMath_ReadCallback(tri_p3) == -1) + { return NULL; - + } + return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); } @@ -702,18 +767,24 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; if (!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d", - &vector_Type, &pt_vec, - &vector_Type, &quad_p1, - &vector_Type, &quad_p2, - &vector_Type, &quad_p3, - &vector_Type, &quad_p4) - ) { + &vector_Type, &pt_vec, + &vector_Type, &quad_p1, + &vector_Type, &quad_p2, + &vector_Type, &quad_p3, + &vector_Type, &quad_p4)) + { return NULL; } - - if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(quad_p1) == -1 || BaseMath_ReadCallback(quad_p2) == -1 || BaseMath_ReadCallback(quad_p3) == -1 || BaseMath_ReadCallback(quad_p4) == -1) + + if ( BaseMath_ReadCallback(pt_vec) == -1 || + BaseMath_ReadCallback(quad_p1) == -1 || + BaseMath_ReadCallback(quad_p2) == -1 || + BaseMath_ReadCallback(quad_p3) == -1 || + BaseMath_ReadCallback(quad_p4) == -1) + { return NULL; - + } + return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec)); } @@ -738,8 +809,8 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb if (!PyArg_ParseTuple(args, "O!O!O!:distance_point_to_plane", &vector_Type, &pt, &vector_Type, &plene_co, - &vector_Type, &plane_no) - ) { + &vector_Type, &plane_no)) + { return NULL; } @@ -783,14 +854,14 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje float vec[3]; if (!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", - &vector_Type, &vec_pt, - &vector_Type, &vec_t1_src, - &vector_Type, &vec_t2_src, - &vector_Type, &vec_t3_src, - &vector_Type, &vec_t1_tar, - &vector_Type, &vec_t2_tar, - &vector_Type, &vec_t3_tar) - ) { + &vector_Type, &vec_pt, + &vector_Type, &vec_t1_src, + &vector_Type, &vec_t2_src, + &vector_Type, &vec_t3_src, + &vector_Type, &vec_t1_tar, + &vector_Type, &vec_t2_tar, + &vector_Type, &vec_t3_tar)) + { return NULL; } @@ -850,11 +921,11 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* if (!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", - &vector_Type, &vec_k1, - &vector_Type, &vec_h1, - &vector_Type, &vec_h2, - &vector_Type, &vec_k2, &resolu) - ) { + &vector_Type, &vec_k1, + &vector_Type, &vec_h1, + &vector_Type, &vec_h2, + &vector_Type, &vec_k2, &resolu)) + { return NULL; } @@ -864,8 +935,13 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* return NULL; } - if (BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) + if ( BaseMath_ReadCallback(vec_k1) == -1 || + BaseMath_ReadCallback(vec_h1) == -1 || + BaseMath_ReadCallback(vec_k2) == -1 || + BaseMath_ReadCallback(vec_h2) == -1) + { return NULL; + } dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size); From f79d14dcfa40d3d780ded09ef1b473d7e546d438 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 13 Nov 2011 10:05:07 +0000 Subject: [PATCH 004/203] Cycles Addon: * Added URL to wiki * Marked as official * api/blender bump --- intern/cycles/blender/addon/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index 979e3e872d7..f5ea39b7e3c 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -20,13 +20,14 @@ bl_info = { "name": "Cycles Render Engine", "author": "", "version": (0,0), - "blender": (2, 5, 6), - "api": 34462, + "blender": (2, 6, 0), + "api": 41670, "location": "Info header, render engine menu", "description": "Cycles Render Engine integration.", "warning": "", - "wiki_url": "", + "wiki_url": "http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles", "tracker_url": "", + "support": 'OFFICIAL', "category": "Render"} import bpy From 11a1c1ec19f50f2b53e65f43b634c6dd7ea73093 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 10:09:34 +0000 Subject: [PATCH 005/203] Fix crash when multires-baking in sculpt mode when sculpt mode is active and sculpt level is set to 0. --- source/blender/editors/object/object_bake.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 5487cbdadb2..03e169e7007 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1001,6 +1001,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l *simple= mmd->simple; tmp_mmd.lvl= mmd->totlvl; + tmp_mmd.sculptlvl= mmd->totlvl; dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0); cddm->release(cddm); From 05d09feeee3cfc70957c079610c8fcbb12a5b711 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 10:48:46 +0000 Subject: [PATCH 006/203] Speedup of multires baker Issue was caused by how CCGDM handles ORIGINDEX cystom layer: It runs cycle through all faces to fill origindex array on each call of dm->getFaceDataArray(dm, CD_ORIGINDEX) Solved issue by obtaining origindex array once on baker data initialization and using this stored array when interpolating multires grid data. --- source/blender/editors/object/object_bake.c | 41 +++++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 03e169e7007..2d5f0b5ff2b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -153,8 +153,13 @@ typedef struct { float height_min, height_max; Image *ima; DerivedMesh *ssdm; + const int *origindex; } MHeightBakeData; +typedef struct { + const int *origindex; +} MNormalBakeData; + static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index) { unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2, @@ -501,7 +506,7 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f interp_bilinear_quad_data(data, u, v, res); } -static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) +static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) { MFace mface; DMGridData **grid_data; @@ -521,9 +526,8 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, g_index= grid_offset[face_index]; S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y); } else { - const int *index= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); int side= (1 << (lvl-1)) + 1; - int grid_index= index[face_index]; + int grid_index= origindex[face_index]; int loc_offs= face_index % (1<<(2*lvl)); int cell_index= loc_offs % ((side-1)*(side-1)); int cell_side= grid_size / (side-1); @@ -587,10 +591,11 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float interp_barycentric_tri_data(data, u, v, res); } -static void *init_heights_data(MultiresBakeRender *bkr, Image* ima) +static void *init_heights_data(MultiresBakeRender *bkr, Image *ima) { MHeightBakeData *height_data; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + DerivedMesh *lodm= bkr->lores_dm; height_data= MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData"); @@ -614,9 +619,23 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image* ima) height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0); } + height_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); + return (void*)height_data; } +static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima)) +{ + MNormalBakeData *normal_data; + DerivedMesh *lodm= bkr->lores_dm; + + normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData"); + + normal_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); + + return (void*)normal_data; +} + static void apply_heights_data(void *bake_data) { MHeightBakeData *height_data= (MHeightBakeData*)bake_data; @@ -698,13 +717,11 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); - get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], p1, 0); + get_ccgdm_data(lores_dm, hires_dm, height_data->origindex, lvl, face_index, uv[0], uv[1], p1, 0); if(height_data->ssdm) { - //get_ccgdm_data_ss(lores_dm, height_data->ssdm, lvl, face_index, uv[0], uv[1], p0, n); - get_ccgdm_data(lores_dm, height_data->ssdm, 0, face_index, uv[0], uv[1], p0, n); + get_ccgdm_data(lores_dm, height_data->ssdm, height_data->origindex, 0, face_index, uv[0], uv[1], p0, n); } else { - MFace mface; lores_dm->getFace(lores_dm, face_index, &mface); if(mface.v4) { @@ -717,7 +734,6 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, } sub_v3_v3v3(vec, p1, p0); - //len= len_v3(vec); len= dot_v3v3(n, vec); height_data->heights[pixel]= len; @@ -740,7 +756,7 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, - find coord and normal of point with specified UV in hi-res mesh - multiply it by tangmat - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */ -static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *UNUSED(bake_data), +static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y) { @@ -748,6 +764,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, MFace mface; Image *ima= mtface[face_index].tpage; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + MNormalBakeData *normal_data= (MNormalBakeData*)bake_data; float uv[2], *st0, *st1, *st2, *st3; int pixel= ibuf->x*y + x; float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5}; @@ -767,7 +784,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); - get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], NULL, n); + get_ccgdm_data(lores_dm, hires_dm, normal_data->origindex, lvl, face_index, uv[0], uv[1], NULL, n); mul_v3_m3v3(vec, tangmat, n); normalize_v3(vec); @@ -832,7 +849,7 @@ static void bake_images(MultiresBakeRender *bkr) switch(bkr->mode) { case RE_BAKE_NORMALS: - do_multires_bake(bkr, ima, apply_tangmat_callback, NULL, NULL, NULL); + do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, NULL); break; case RE_BAKE_DISPLACEMENT: do_multires_bake(bkr, ima, apply_heights_callback, init_heights_data, From b1019a56b54294fc91293c5c43ef46d54950ae84 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 13 Nov 2011 11:40:35 +0000 Subject: [PATCH 007/203] Cycles: * Typo fix, patch by David on the mailing list. --- intern/cycles/kernel/kernel_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index a1b23128b38..ea866221487 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -49,7 +49,7 @@ typedef struct KernelGlobals { OSLGlobals osl; #endif -} KernelGLobals; +} KernelGlobals; #endif From 11c83d843206648a33bcc8b4d754577ec0a51d2a Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Sun, 13 Nov 2011 12:17:27 +0000 Subject: [PATCH 008/203] Ocean Sim modifier patch by Matt Ebb, Hamed Zaghaghi This adds a new Modifier "Ocean" to simulate large-scale wave motion. Details can be found in the wiki documentation [1], the project homepage [2] and the patch tracker [3] The modifier is disabled by default for now. To enable it, the WITH_OCEANSIM (cmake) / WITH_BF_OCEANSIM (scons) flags have to be set. The code depends on fftw3, so this also has to be enabled. [1] http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Simulation/Ocean [2] http://www.savetheoceansim.com [3] http://projects.blender.org/tracker/?group_id=9&atid=127&func=detail&aid=28338 --- CMakeLists.txt | 6 + SConstruct | 5 + build_files/scons/tools/btools.py | 2 + .../startup/bl_ui/properties_data_modifier.py | 68 + .../startup/bl_ui/properties_texture.py | 16 + source/blender/blenkernel/BKE_ocean.h | 108 ++ source/blender/blenkernel/BKE_texture.h | 5 + source/blender/blenkernel/CMakeLists.txt | 11 + source/blender/blenkernel/SConscript | 7 + source/blender/blenkernel/intern/ocean.c | 1407 +++++++++++++++++ source/blender/blenkernel/intern/texture.c | 44 +- source/blender/blenloader/intern/readfile.c | 32 + source/blender/blenloader/intern/writefile.c | 1 + source/blender/editors/object/object_intern.h | 1 + .../blender/editors/object/object_modifier.c | 219 +++ source/blender/editors/object/object_ops.c | 1 + source/blender/makesdna/DNA_modifier_types.h | 59 + source/blender/makesdna/DNA_texture_types.h | 24 + source/blender/makesrna/RNA_access.h | 3 + source/blender/makesrna/SConscript | 3 + source/blender/makesrna/intern/CMakeLists.txt | 4 + source/blender/makesrna/intern/rna_modifier.c | 230 +++ source/blender/makesrna/intern/rna_texture.c | 52 + source/blender/modifiers/CMakeLists.txt | 9 + source/blender/modifiers/MOD_modifiertypes.h | 1 + source/blender/modifiers/SConscript | 3 + source/blender/modifiers/intern/MOD_ocean.c | 561 +++++++ source/blender/modifiers/intern/MOD_util.c | 1 + source/blender/render/CMakeLists.txt | 2 + .../render/intern/include/texture_ocean.h | 28 + .../render/intern/source/render_texture.c | 11 +- .../render/intern/source/texture_ocean.c | 162 ++ 32 files changed, 3084 insertions(+), 2 deletions(-) create mode 100644 source/blender/blenkernel/BKE_ocean.h create mode 100644 source/blender/blenkernel/intern/ocean.c create mode 100644 source/blender/modifiers/intern/MOD_ocean.c create mode 100644 source/blender/render/intern/include/texture_ocean.h create mode 100644 source/blender/render/intern/source/texture_ocean.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ef022f3c1..40239a16f02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,7 @@ option(WITH_MOD_DECIMATE "Enable Decimate Modifier" ON) option(WITH_MOD_BOOLEAN "Enable Boolean Modifier" ON) option(WITH_MOD_CLOTH_ELTOPO "Enable Experemental cloth solver" OFF) mark_as_advanced(WITH_MOD_CLOTH_ELTOPO) +option(WITH_OCEANSIM "Enable Ocean Modifier" OFF) # Image format support option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON) @@ -285,6 +286,10 @@ if(WITH_CODEC_QUICKTIME AND MINGW) "line if youre a developer who wants to add support.") endif() +if(NOT WITH_FFTW3 AND WITH_OCEANSIM) + message(FATAL_ERROR "WITH_OCEANSIM requires WITH_FFTW3 to be ON") +endif() + # may as well build python module without a UI if(WITH_PYTHON_MODULE) set(WITH_HEADLESS ON) @@ -1562,6 +1567,7 @@ if(FIRST_RUN) info_cfg_option(WITH_MOD_BOOLEAN) info_cfg_option(WITH_MOD_DECIMATE) info_cfg_option(WITH_MOD_FLUID) + info_cfg_option(WITH_OCEANSIM) info_cfg_text("") diff --git a/SConstruct b/SConstruct index 161bbbc0378..57da56872aa 100644 --- a/SConstruct +++ b/SConstruct @@ -254,6 +254,7 @@ if 'blenderlite' in B.targets: target_env_defs['WITH_BF_BINRELOC'] = False target_env_defs['BF_BUILDINFO'] = False target_env_defs['WITH_BF_FLUID'] = False + target_env_defs['WITH_BF_OCEANSIM'] = False target_env_defs['WITH_BF_DECIMATE'] = False target_env_defs['WITH_BF_BOOLEAN'] = False target_env_defs['WITH_BF_PYTHON'] = False @@ -329,6 +330,10 @@ if 'blendernogame' in B.targets: if env['WITH_BF_FLUID'] == 1: env['CPPFLAGS'].append('-DWITH_MOD_FLUID') +# build with ocean sim? +if env['WITH_BF_OCEANSIM'] == 1: + env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM') + if btools.ENDIAN == "big": env['CPPFLAGS'].append('-D__BIG_ENDIAN__') diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 417bbcc48ba..856231e3c84 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -152,6 +152,7 @@ def validate_arguments(args, bc): 'WITH_BF_FLUID', 'WITH_BF_DECIMATE', 'WITH_BF_BOOLEAN', + 'WITH_BF_OCEANSIM', 'WITH_BF_CXX_GUARDEDALLOC', 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', 'BUILDBOT_BRANCH', @@ -259,6 +260,7 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_FLUID', 'Build with Fluid simulation (Elbeem)', True)), (BoolVariable('WITH_BF_DECIMATE', 'Build with decimate modifier', True)), (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)), + (BoolVariable('WITH_BF_OCEANSIM', 'Build with ocean simulation', False)), ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''), (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)), ('BF_OPENAL', 'Base path for OpenAL', ''), diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index e1b08d1ff8e..0340c933cdd 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -414,6 +414,74 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): row.operator("object.multires_external_save", text="Save External...") row.label() + def OCEAN(self, layout, ob, md): + col = layout.column() + + if not md.build_enabled: + col.label("Built without OceanSim modifier") + return + + col.prop(md, "geometry_mode") + + if md.geometry_mode == 'GENERATE': + row = col.row() + row.prop(md, "repeat_x") + row.prop(md, "repeat_y") + + col.separator() + + col.prop(md, "time") + col.prop(md, "resolution") + colflow = col.column_flow() + colflow.prop(md, "spatial_size") + colflow.prop(md, "depth") + + + col.label("Waves:") + col.prop(md, "choppiness") + col.prop(md, "wave_scale", text="Scale") + + col.prop(md, "wave_alignment", text="Alignment") + row = col.row() + row.active = md.wave_alignment > 0 + row.prop(md, "wave_direction", text="Direction") + row.prop(md, "damp") + + col.prop(md, "smallest_wave") + col.prop(md, "wind_velocity") + + + col = layout.column() + col.separator() + + col.prop(md, "generate_normals") + + split = col.split() + split.column().prop(md, "generate_foam") + + col = split.column() + col.active = md.generate_foam + col.prop(md, "foam_coverage", text="Coverage") + + + col = layout.column() + col.separator() + + if md.is_cached: + col.operator("object.ocean_bake", text="Free Bake").free=True + else: + col.operator("object.ocean_bake") + row = col.row() + row.enabled = not md.is_cached + row.prop(md, "bake_start", text="Start") + row.prop(md, "bake_end", text="End") + col.prop(md, "cachepath") + + #col.prop(md, "bake_foam_fade") + + + + def PARTICLE_INSTANCE(self, layout, ob, md): layout.prop(md, "object") layout.prop(md, "particle_system_index", text="Particle System") diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 9ba0309aacd..70c231b11bf 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -774,6 +774,22 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, Panel): col.prop(pd, "turbulence_strength") +class TEXTURE_PT_ocean(TextureTypePanel, Panel): + bl_label = "Ocean" + tex_type = 'OCEAN' + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + + tex = context.texture + ot = tex.ocean + + col = layout.column() + col.prop(ot, "ocean_object") + col.prop(ot, "output") + + class TEXTURE_PT_mapping(TextureSlotPanel, Panel): bl_label = "Mapping" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h new file mode 100644 index 00000000000..c1f228fe186 --- /dev/null +++ b/source/blender/blenkernel/BKE_ocean.h @@ -0,0 +1,108 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributors: Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BKE_OCEAN_H +#define BKE_OCEAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OceanResult { + float disp[3]; + float normal[3]; + float foam; + + /* raw eigenvalues/vectors */ + float Jminus; + float Jplus; + float Eminus[3]; + float Eplus[3]; +} OceanResult; + + +typedef struct OceanCache { + struct ImBuf **ibufs_disp; + struct ImBuf **ibufs_foam; + struct ImBuf **ibufs_norm; + + char *bakepath; + + /* precalculated for time range */ + float *time; + + /* constant for time range */ + float wave_scale; + float chop_amount; + float foam_coverage; + float foam_fade; + + int start; + int end; + int duration; + int resolution_x; + int resolution_y; + + int baked; +} OceanCache; + + +#define OCEAN_NOT_CACHED 0 +#define OCEAN_CACHING 1 +#define OCEAN_CACHED 2 + + +struct Ocean *BKE_add_ocean(void); +void BKE_free_ocean_data(struct Ocean *oc); +void BKE_free_ocean(struct Ocean *oc); + +void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp, + float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed); +void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount); + +/* sampling the ocean surface */ +float BKE_ocean_jminus_to_foam(float jminus, float coverage); +void BKE_ocean_eval_uv(struct Ocean * oc, struct OceanResult *ocr, float u, float v); +void BKE_ocean_eval_uv_catrom(struct Ocean * oc, struct OceanResult *ocr, float u, float v); +void BKE_ocean_eval_xz(struct Ocean * oc, struct OceanResult *ocr, float x, float z); +void BKE_ocean_eval_xz_catrom(struct Ocean * oc, struct OceanResult *ocr, float x, float z); +void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j); + + +/* ocean cache handling */ +struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, + float chop_amount, float foam_coverage, float foam_fade, int resolution); +void BKE_simulate_ocean_cache(struct OceanCache *och, int frame); + +void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data); +void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v); +void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j); + +void BKE_free_ocean_cache(struct OceanCache *och); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 508fef8d9a4..52fa52a5899 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -46,6 +46,7 @@ struct Lamp; struct LampRen; struct Material; struct MTex; +struct OceanTex; struct ParticleSettings; struct PluginTex; struct PointDensity; @@ -125,6 +126,10 @@ void BKE_free_voxeldata(struct VoxelData *vd); struct VoxelData *BKE_add_voxeldata(void); struct VoxelData *BKE_copy_voxeldata(struct VoxelData *vd); +void BKE_free_oceantex(struct OceanTex *ot); +struct OceanTex *BKE_add_oceantex(void); +struct OceanTex *BKE_copy_oceantex(struct OceanTex *ot); + int BKE_texture_dependsOnTime(const struct Tex *texture); #ifdef __cplusplus diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 1fc851bfa72..4e7561a1bc8 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -117,6 +117,7 @@ set(SRC intern/multires.c intern/nla.c intern/node.c + intern/ocean.c intern/object.c intern/packedFile.c intern/paint.c @@ -204,6 +205,7 @@ set(SRC BKE_multires.h BKE_nla.h BKE_node.h + BKE_ocean.h BKE_object.h BKE_packedFile.h BKE_paint.h @@ -341,6 +343,10 @@ if(WITH_MOD_SMOKE) add_definitions(-DWITH_SMOKE) endif() +if(WITH_OCEANSIM) + add_definitions(-DWITH_OCEANSIM) +endif() + if(WITH_JACK) add_definitions(-DWITH_JACK) endif() @@ -378,6 +384,11 @@ if(WITH_LIBMV) add_definitions(-DWITH_LIBMV) endif() +if(WITH_FFTW3) + list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS}) + add_definitions(-DFFTW3=1) +endif() + ## Warnings as errors, this is too strict! #if(MSVC) # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 48a68c433a6..62a8aa8362f 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -82,6 +82,9 @@ if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_FLUID']: defs.append('WITH_MOD_FLUID') +if env['WITH_BF_OCEANSIM']: + defs.append('WITH_OCEANSIM') + if env['WITH_BF_LZO']: incs += ' #/extern/lzo/minilzo' defs.append('WITH_LZO') @@ -100,6 +103,10 @@ if env['WITH_BF_LIBMV']: incs += ' #/extern/libmv' defs.append('WITH_LIBMV') +if env['WITH_BF_FFTW3']: + defs.append('FFTW3=1') + incs += ' ' + env['BF_FFTW3_INC'] + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c new file mode 100644 index 00000000000..455acd2130f --- /dev/null +++ b/source/blender/blenkernel/intern/ocean.c @@ -0,0 +1,1407 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributors: Matt Ebb, Hamed Zaghaghi + * Based on original code by Drew Whitehouse / Houdini Ocean Toolkit + * OpenMP hints by Christian Schnellhammer + * + * ***** END GPL LICENSE BLOCK ***** + */ + + +#include +#include + +#include + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" + +#include "BKE_image.h" +#include "BKE_ocean.h" +#include "BKE_utildefines.h" + +#include "BKE_global.h" // XXX TESTING + +#include "BLI_math_base.h" +#include "BLI_math_inline.h" +#include "BLI_rand.h" +#include "BLI_string.h" +#include "BLI_threads.h" +#include "BLI_utildefines.h" + +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" + +#include "RE_render_ext.h" + +#ifdef WITH_OCEANSIM + +// Ocean code +#include "fftw3.h" + +#define GRAVITY 9.81f + +typedef struct Ocean { + /* ********* input parameters to the sim ********* */ + float _V; + float _l; + float _w; + float _A; + float _damp_reflections; + float _wind_alignment; + float _depth; + + float _wx; + float _wz; + + float _L; + + /* dimensions of computational grid */ + int _M; + int _N; + + /* spatial size of computational grid */ + float _Lx; + float _Lz; + + float normalize_factor; // init w + float time; + + short _do_disp_y; + short _do_normals; + short _do_chop; + short _do_jacobian; + + /* mutex for threaded texture access */ + ThreadRWMutex oceanmutex; + + /* ********* sim data arrays ********* */ + + /* two dimensional arrays of complex */ + fftw_complex *_fft_in; // init w sim w + fftw_complex *_fft_in_x; // init w sim w + fftw_complex *_fft_in_z; // init w sim w + fftw_complex *_fft_in_jxx; // init w sim w + fftw_complex *_fft_in_jzz; // init w sim w + fftw_complex *_fft_in_jxz; // init w sim w + fftw_complex *_fft_in_nx; // init w sim w + fftw_complex *_fft_in_nz; // init w sim w + fftw_complex *_htilda; // init w sim w (only once) + + /* fftw "plans" */ + fftw_plan _disp_y_plan; // init w sim r + fftw_plan _disp_x_plan; // init w sim r + fftw_plan _disp_z_plan; // init w sim r + fftw_plan _N_x_plan; // init w sim r + fftw_plan _N_z_plan; // init w sim r + fftw_plan _Jxx_plan; // init w sim r + fftw_plan _Jxz_plan; // init w sim r + fftw_plan _Jzz_plan; // init w sim r + + /* two dimensional arrays of float */ + double * _disp_y; // init w sim w via plan? + double * _N_x; // init w sim w via plan? + /*float * _N_y; all member of this array has same values, so convert this array to a float to reduce memory usage (MEM01)*/ + double _N_y; // sim w ********* can be rearranged? + double * _N_z; // init w sim w via plan? + double * _disp_x; // init w sim w via plan? + double * _disp_z; // init w sim w via plan? + + /* two dimensional arrays of float */ + /* Jacobian and minimum eigenvalue */ + double * _Jxx; // init w sim w + double * _Jzz; // init w sim w + double * _Jxz; // init w sim w + + /* one dimensional float array */ + float * _kx; // init w sim r + float * _kz; // init w sim r + + /* two dimensional complex array */ + fftw_complex * _h0; // init w sim r + fftw_complex * _h0_minus; // init w sim r + + /* two dimensional float array */ + float * _k; // init w sim r +} Ocean; + + + +static float nextfr(float min, float max) +{ + return BLI_frand()*(min-max)+max; +} + +static float gaussRand (void) +{ + float x; // Note: to avoid numerical problems with very small + float y; // numbers, we make these variables singe-precision + float length2; // floats, but later we call the double-precision log() + // and sqrt() functions instead of logf() and sqrtf(). + do + { + x = (float) (nextfr (-1, 1)); + y = (float)(nextfr (-1, 1)); + length2 = x * x + y * y; + } + while (length2 >= 1 || length2 == 0); + + return x * sqrt (-2 * log (length2) / length2); +} + +/** + * Som usefull functions + * */ +MINLINE float lerp(float a,float b,float f) +{ + return a + (b-a)*f; +} + +MINLINE float catrom(float p0,float p1,float p2,float p3,float f) +{ + return 0.5 *((2 * p1) + + (-p0 + p2) * f + + (2*p0 - 5*p1 + 4*p2 - p3) * f*f + + (-p0 + 3*p1- 3*p2 + p3) * f*f*f); +} + +MINLINE float omega(float k, float depth) +{ + return sqrt(GRAVITY*k * tanh(k*depth)); +} + +// modified Phillips spectrum +static float Ph(struct Ocean* o, float kx,float kz ) +{ + float tmp; + float k2 = kx*kx + kz*kz; + + if (k2 == 0.0) + { + return 0.0; // no DC component + } + + // damp out the waves going in the direction opposite the wind + tmp = (o->_wx * kx + o->_wz * kz)/sqrt(k2); + if (tmp < 0) + { + tmp *= o->_damp_reflections; + } + + return o->_A * exp( -1.0f / (k2*(o->_L*o->_L))) * exp(-k2 * (o->_l*o->_l)) * pow(fabs(tmp),o->_wind_alignment) / (k2*k2); +} + +static void compute_eigenstuff(struct OceanResult *ocr, float jxx,float jzz,float jxz) +{ + float a,b,qplus,qminus; + a = jxx + jzz; + b = sqrt((jxx - jzz)*(jxx - jzz) + 4 * jxz * jxz); + + ocr->Jminus = 0.5*(a-b); + ocr->Jplus = 0.5*(a+b); + + qplus = (ocr->Jplus - jxx)/jxz; + qminus = (ocr->Jminus - jxx)/jxz; + + a = sqrt(1 + qplus*qplus); + b = sqrt(1 + qminus*qminus); + + ocr->Eplus[0] = 1.0/ a; + ocr->Eplus[1] = 0.0; + ocr->Eplus[2] = qplus/a; + + ocr->Eminus[0] = 1.0/b; + ocr->Eminus[1] = 0.0; + ocr->Eminus[2] = qminus/b; +} + +/* + * instead of Complex.h + * in fftw.h "fftw_complex" typedefed as double[2] + * below you can see functions are needed to work with such complex numbers. + * */ +static void init_complex(fftw_complex cmpl, float real, float image) +{ + cmpl[0] = real; + cmpl[1] = image; +} + +#if 0 // unused +static void add_complex_f(fftw_complex res, fftw_complex cmpl, float f) +{ + res[0] = cmpl[0] + f; + res[1] = cmpl[1]; +} +#endif + +static void add_comlex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2) +{ + res[0] = cmpl1[0] + cmpl2[0]; + res[1] = cmpl1[1] + cmpl2[1]; +} + +static void mul_complex_f(fftw_complex res, fftw_complex cmpl, float f) +{ + res[0] = cmpl[0]*f; + res[1] = cmpl[1]*f; +} + +static void mul_complex_c(fftw_complex res, fftw_complex cmpl1, fftw_complex cmpl2) +{ + fftwf_complex temp; + temp[0] = cmpl1[0]*cmpl2[0]-cmpl1[1]*cmpl2[1]; + temp[1] = cmpl1[0]*cmpl2[1]+cmpl1[1]*cmpl2[0]; + res[0] = temp[0]; + res[1] = temp[1]; +} + +static float real_c(fftw_complex cmpl) +{ + return cmpl[0]; +} + +static float image_c(fftw_complex cmpl) +{ + return cmpl[1]; +} + +static void conj_complex(fftw_complex res, fftw_complex cmpl1) +{ + res[0] = cmpl1[0]; + res[1] = -cmpl1[1]; +} + +static void exp_complex(fftw_complex res, fftw_complex cmpl) +{ + float r = expf(cmpl[0]); + + res[0] = cos(cmpl[1])*r; + res[1] = sin(cmpl[1])*r; +} + +float BKE_ocean_jminus_to_foam(float jminus, float coverage) { + float foam = jminus * -0.005 + coverage; + CLAMP(foam, 0.0, 1.0); + return foam*foam; +} + +void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float v) +{ + int i0,i1,j0,j1; + float frac_x,frac_z; + float uu,vv; + + // first wrap the texture so 0 <= (u,v) < 1 + u = fmod(u,1.0f); + v = fmod(v,1.0f); + + if (u < 0) u += 1.0f; + if (v < 0) v += 1.0f; + + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); + + uu = u * oc->_M; + vv = v * oc->_N; + + i0 = (int)floor(uu); + j0 = (int)floor(vv); + + i1 = (i0 + 1); + j1 = (j0 + 1); + + frac_x = uu - i0; + frac_z = vv - j0; + + i0 = i0 % oc->_M; + j0 = j0 % oc->_N; + + i1 = i1 % oc->_M; + j1 = j1 % oc->_N; + + +#define BILERP(m) (lerp(lerp(m[i0*oc->_N+j0],m[i1*oc->_N+j0],frac_x),lerp(m[i0*oc->_N+j1],m[i1*oc->_N+j1],frac_x),frac_z)) + { + if (oc->_do_disp_y) { + ocr->disp[1] = BILERP(oc->_disp_y); + } + + if (oc->_do_normals) { + ocr->normal[0] = BILERP(oc->_N_x); + ocr->normal[1] = oc->_N_y/*BILERP(oc->_N_y) (MEM01)*/; + ocr->normal[2] = BILERP(oc->_N_z); + } + + if (oc->_do_chop) { + ocr->disp[0] = BILERP(oc->_disp_x); + ocr->disp[2] = BILERP(oc->_disp_z); + } else { + ocr->disp[0] = 0.0; + ocr->disp[2] = 0.0; + } + + if (oc->_do_jacobian) { + compute_eigenstuff(ocr, BILERP(oc->_Jxx),BILERP(oc->_Jzz),BILERP(oc->_Jxz)); + } + } +#undef BILERP + + BLI_rw_mutex_unlock(&oc->oceanmutex); +} + +// use catmullrom interpolation rather than linear +void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u,float v) +{ + int i0,i1,i2,i3,j0,j1,j2,j3; + float frac_x,frac_z; + float uu,vv; + + // first wrap the texture so 0 <= (u,v) < 1 + u = fmod(u,1.0f); + v = fmod(v,1.0f); + + if (u < 0) u += 1.0f; + if (v < 0) v += 1.0f; + + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); + + uu = u * oc->_M; + vv = v * oc->_N; + + i1 = (int)floor(uu); + j1 = (int)floor(vv); + + i2 = (i1 + 1); + j2 = (j1 + 1); + + frac_x = uu - i1; + frac_z = vv - j1; + + i1 = i1 % oc->_M; + j1 = j1 % oc->_N; + + i2 = i2 % oc->_M; + j2 = j2 % oc->_N; + + i0 = (i1-1); + i3 = (i2+1); + i0 = i0 < 0 ? i0 + oc->_M : i0; + i3 = i3 >= oc->_M ? i3 - oc->_M : i3; + + j0 = (j1-1); + j3 = (j2+1); + j0 = j0 < 0 ? j0 + oc->_N : j0; + j3 = j3 >= oc->_N ? j3 - oc->_N : j3; + +#define INTERP(m) catrom(catrom(m[i0*oc->_N+j0],m[i1*oc->_N+j0],m[i2*oc->_N+j0],m[i3*oc->_N+j0],frac_x),\ +catrom(m[i0*oc->_N+j1],m[i1*oc->_N+j1],m[i2*oc->_N+j1],m[i3*oc->_N+j1],frac_x),\ +catrom(m[i0*oc->_N+j2],m[i1*oc->_N+j2],m[i2*oc->_N+j2],m[i3*oc->_N+j2],frac_x),\ +catrom(m[i0*oc->_N+j3],m[i1*oc->_N+j3],m[i2*oc->_N+j3],m[i3*oc->_N+j3],frac_x),\ +frac_z) + + { + if (oc->_do_disp_y) + { + ocr->disp[1] = INTERP(oc->_disp_y) ; + } + if (oc->_do_normals) + { + ocr->normal[0] = INTERP(oc->_N_x); + ocr->normal[1] = oc->_N_y/*INTERP(oc->_N_y) (MEM01)*/; + ocr->normal[2] = INTERP(oc->_N_z); + } + if (oc->_do_chop) + { + ocr->disp[0] = INTERP(oc->_disp_x); + ocr->disp[2] = INTERP(oc->_disp_z); + } + else + { + ocr->disp[0] = 0.0; + ocr->disp[2] = 0.0; + } + + if (oc->_do_jacobian) + { + compute_eigenstuff(ocr, INTERP(oc->_Jxx),INTERP(oc->_Jzz),INTERP(oc->_Jxz)); + } + } +#undef INTERP + + BLI_rw_mutex_unlock(&oc->oceanmutex); + +} + +void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x,float z) +{ + BKE_ocean_eval_uv(oc, ocr, x/oc->_Lx,z/oc->_Lz); +} + +void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x,float z) +{ + BKE_ocean_eval_uv_catrom(oc, ocr, x/oc->_Lx,z/oc->_Lz); +} + +// note that this doesn't wrap properly for i,j < 0, but its +// not really meant for that being just a way to get the raw data out +// to save in some image format. +void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j) +{ + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); + + i = abs(i) % oc->_M; + j = abs(j) % oc->_N; + + ocr->disp[1] = oc->_do_disp_y ? oc->_disp_y[i*oc->_N+j] : 0.0f; + + if (oc->_do_chop) + { + ocr->disp[0] = oc->_disp_x[i*oc->_N+j]; + ocr->disp[2] = oc->_disp_z[i*oc->_N+j]; + } + else + { + ocr->disp[0] = 0.0f; + ocr->disp[2] = 0.0f; + } + + if (oc->_do_normals) + { + ocr->normal[0] = oc->_N_x[i*oc->_N+j]; + ocr->normal[1] = oc->_N_y/*oc->_N_y[i*oc->_N+j] (MEM01)*/; + ocr->normal[2] = oc->_N_z[i*oc->_N+j]; + } + + if (oc->_do_jacobian) + { + compute_eigenstuff(ocr, oc->_Jxx[i*oc->_N+j],oc->_Jzz[i*oc->_N+j],oc->_Jxz[i*oc->_N+j]); + } + + BLI_rw_mutex_unlock(&oc->oceanmutex); +} + +void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount) +{ + int i, j; + + scale *= o->normalize_factor; + + BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE); + + // compute a new htilda + #pragma omp parallel for private(i, j) + for (i = 0 ; i < o->_M ; ++i) + { + // note the <= _N/2 here, see the fftw doco about + // the mechanics of the complex->real fft storage + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex exp_param1; + fftw_complex exp_param2; + fftw_complex conj_param; + + + init_complex(exp_param1, 0.0, omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); + init_complex(exp_param2, 0.0, -omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); + exp_complex(exp_param1, exp_param1); + exp_complex(exp_param2, exp_param2); + conj_complex(conj_param, o->_h0_minus[i*o->_N+j]); + + mul_complex_c(exp_param1, o->_h0[i*o->_N+j], exp_param1); + mul_complex_c(exp_param2, conj_param, exp_param2); + + add_comlex_c(o->_htilda[i*(1+o->_N/2)+j], exp_param1, exp_param2); + mul_complex_f(o->_fft_in[i*(1+o->_N/2)+j], o->_htilda[i*(1+o->_N/2)+j], scale); + } + } + + #pragma omp parallel sections private(i, j) + { + + #pragma omp section + { + if (o->_do_disp_y) + { + // y displacement + fftw_execute(o->_disp_y_plan); + } + } // section 1 + + #pragma omp section + { + if (o->_do_chop) + { + // x displacement + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + fftw_complex minus_i; + + init_complex(minus_i, 0.0, -1.0); + init_complex(mul_param, -scale, 0); + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, minus_i); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_x[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_disp_x_plan); + } + } //section 2 + + #pragma omp section + { + if (o->_do_chop) + { + // z displacement + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + fftw_complex minus_i; + + init_complex(minus_i, 0.0, -1.0); + init_complex(mul_param, -scale, 0); + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, minus_i); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_z[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_disp_z_plan); + } + } // section 3 + + #pragma omp section + { + if (o->_do_jacobian) + { + // Jxx + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i]*o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jxx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_Jxx_plan); + + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j < o->_N ; ++j) + { + o->_Jxx[i*o->_N+j] += 1.0; + } + } + } + } // section 4 + + #pragma omp section + { + if (o->_do_jacobian) + { + // Jzz + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jzz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_Jzz_plan); + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j < o->_N ; ++j) + { + o->_Jzz[i*o->_N+j] += 1.0; + } + } + } + } // section 5 + + #pragma omp section + { + if (o->_do_jacobian) + { + // Jxz + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jxz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_Jxz_plan); + } + } // section 6 + + #pragma omp section + { + // fft normals + if (o->_do_normals) + { + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + init_complex(mul_param, 0.0, -1.0); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, o->_kx[i]); + init_complex(o->_fft_in_nx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_N_x_plan); + + } + } // section 7 + + #pragma omp section + { + if (o->_do_normals) + { + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + init_complex(mul_param, 0.0, -1.0); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, o->_kz[i]); + init_complex(o->_fft_in_nz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_N_z_plan); + + /*for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j < o->_N ; ++j) + { + o->_N_y[i*o->_N+j] = 1.0f/scale; + } + } + (MEM01)*/ + o->_N_y = 1.0f/scale; + } + } // section 8 + + } // omp sections + + BLI_rw_mutex_unlock(&o->oceanmutex); +} + +static void set_height_normalize_factor(struct Ocean *oc) +{ + float res = 1.0; + float max_h = 0.0; + + int i,j; + + if (!oc->_do_disp_y) return; + + oc->normalize_factor = 1.0; + + BKE_simulate_ocean(oc, 0.0, 1.0, 0); + + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); + + for (i = 0; i < oc->_M; ++i) + { + for (j = 0; j < oc->_N; ++j) + { + if( max_h < fabsf(oc->_disp_y[i*oc->_N+j])) + { + max_h = fabsf(oc->_disp_y[i*oc->_N+j]); + } + } + } + + BLI_rw_mutex_unlock(&oc->oceanmutex); + + if (max_h == 0.0) max_h = 0.00001f; // just in case ... + + res = 1.0f / (max_h); + + oc->normalize_factor = res; +} + +struct Ocean *BKE_add_ocean(void) +{ + Ocean *oc = MEM_callocN(sizeof(Ocean), "ocean sim data"); + + BLI_rw_mutex_init(&oc->oceanmutex); + + return oc; +} + +void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp, + float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed) +{ + int i,j,ii; + + BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE); + + o->_M = M; + o->_N = N; + o->_V = V; + o->_l = l; + o->_A = A; + o->_w = w; + o->_damp_reflections = 1.0 - damp; + o->_wind_alignment = alignment; + o->_depth = depth; + o->_Lx = Lx; + o->_Lz = Lz; + o->_wx = cos(w); + o->_wz = -sin(w); // wave direction + o->_L = V*V / GRAVITY; // largest wave for a given velocity V + o->time = time; + + o->_do_disp_y = do_height_field; + o->_do_normals = do_normals; + o->_do_chop = do_chop; + o->_do_jacobian = do_jacobian; + + o->_k = (float*) MEM_mallocN(M * (1+N/2) * sizeof(float), "ocean_k"); + o->_h0 = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0"); + o->_h0_minus = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0_minus"); + o->_kx = (float*) MEM_mallocN(o->_M * sizeof(float), "ocean_kx"); + o->_kz = (float*) MEM_mallocN(o->_N * sizeof(float), "ocean_kz"); + + // make this robust in the face of erroneous usage + if (o->_Lx == 0.0) + o->_Lx = 0.001; + + if (o->_Lz == 0.0) + o->_Lz = 0.001; + + // the +ve components and DC + for (i = 0 ; i <= o->_M/2 ; ++i) + o->_kx[i] = 2.0f * M_PI * i / o->_Lx; + + // the -ve components + for (i = o->_M-1,ii=0 ; i > o->_M/2 ; --i,++ii) + o->_kx[i] = -2.0f * M_PI * ii / o->_Lx; + + // the +ve components and DC + for (i = 0 ; i <= o->_N/2 ; ++i) + o->_kz[i] = 2.0f * M_PI * i / o->_Lz; + + // the -ve components + for (i = o->_N-1,ii=0 ; i > o->_N/2 ; --i,++ii) + o->_kz[i] = -2.0f * M_PI * ii / o->_Lz; + + // pre-calculate the k matrix + for (i = 0 ; i < o->_M ; ++i) + for (j = 0 ; j <= o->_N / 2 ; ++j) + o->_k[i*(1+o->_N/2)+j] = sqrt(o->_kx[i]*o->_kx[i] + o->_kz[j]*o->_kz[j] ); + + /*srand(seed);*/ + BLI_srand(seed); + + for (i = 0 ; i < o->_M ; ++i) + { + for (j = 0 ; j < o->_N ; ++j) + { + float r1 = gaussRand(); + float r2 = gaussRand(); + + fftw_complex r1r2; + init_complex(r1r2, r1, r2); + mul_complex_f(o->_h0[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); + mul_complex_f(o->_h0_minus[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i],-o->_kz[j]) / 2.0f))); + } + } + + o->_fft_in = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in"); + o->_htilda = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_htilda"); + + if (o->_do_disp_y){ + o->_disp_y = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y"); + o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE); + } + + if (o->_do_normals){ + o->_fft_in_nx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nx"); + o->_fft_in_nz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nz"); + + o->_N_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_x"); + /*o->_N_y = (float*) fftwf_malloc(o->_M * o->_N * sizeof(float)); (MEM01)*/ + o->_N_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_z"); + + o->_N_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nx, o->_N_x, FFTW_ESTIMATE); + o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE); + } + + if (o->_do_chop){ + o->_fft_in_x = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_x"); + o->_fft_in_z = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_z"); + + o->_disp_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_x"); + o->_disp_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_z"); + + o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE); + o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE); + } + if (o->_do_jacobian){ + o->_fft_in_jxx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxx"); + o->_fft_in_jzz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jzz"); + o->_fft_in_jxz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxz"); + + o->_Jxx = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxx"); + o->_Jzz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jzz"); + o->_Jxz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxz"); + + o->_Jxx_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxx, o->_Jxx, FFTW_ESTIMATE); + o->_Jzz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jzz, o->_Jzz, FFTW_ESTIMATE); + o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE); + } + + BLI_rw_mutex_unlock(&o->oceanmutex); + + set_height_normalize_factor(o); + +} + +void BKE_free_ocean_data(struct Ocean *oc) +{ + if(!oc) return; + + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE); + + if (oc->_do_disp_y) + { + fftw_destroy_plan(oc->_disp_y_plan); + MEM_freeN(oc->_disp_y); + } + + if (oc->_do_normals) + { + MEM_freeN(oc->_fft_in_nx); + MEM_freeN(oc->_fft_in_nz); + fftw_destroy_plan(oc->_N_x_plan); + fftw_destroy_plan(oc->_N_z_plan); + MEM_freeN(oc->_N_x); + /*fftwf_free(oc->_N_y); (MEM01)*/ + MEM_freeN(oc->_N_z); + } + + if (oc->_do_chop) + { + MEM_freeN(oc->_fft_in_x); + MEM_freeN(oc->_fft_in_z); + fftw_destroy_plan(oc->_disp_x_plan); + fftw_destroy_plan(oc->_disp_z_plan); + MEM_freeN(oc->_disp_x); + MEM_freeN(oc->_disp_z); + } + + if (oc->_do_jacobian) + { + MEM_freeN(oc->_fft_in_jxx); + MEM_freeN(oc->_fft_in_jzz); + MEM_freeN(oc->_fft_in_jxz); + fftw_destroy_plan(oc->_Jxx_plan); + fftw_destroy_plan(oc->_Jzz_plan); + fftw_destroy_plan(oc->_Jxz_plan); + MEM_freeN(oc->_Jxx); + MEM_freeN(oc->_Jzz); + MEM_freeN(oc->_Jxz); + } + + if (oc->_fft_in) + MEM_freeN(oc->_fft_in); + + /* check that ocean data has been initialised */ + if (oc->_htilda) { + MEM_freeN(oc->_htilda); + MEM_freeN(oc->_k); + MEM_freeN(oc->_h0); + MEM_freeN(oc->_h0_minus); + MEM_freeN(oc->_kx); + MEM_freeN(oc->_kz); + } + + BLI_rw_mutex_unlock(&oc->oceanmutex); +} + +void BKE_free_ocean(struct Ocean *oc) +{ + if(!oc) return; + + BKE_free_ocean_data(oc); + BLI_rw_mutex_end(&oc->oceanmutex); + + MEM_freeN(oc); +} + +#undef GRAVITY + + +/* ********* Baking/Caching ********* */ + + +#define CACHE_TYPE_DISPLACE 1 +#define CACHE_TYPE_FOAM 2 +#define CACHE_TYPE_NORMAL 3 + +static void cache_filename(char *string, char *path, int frame, int type) +{ + char *cachepath=NULL; + + switch(type) { + case CACHE_TYPE_FOAM: + cachepath = BLI_strdupcat(path, "foam_"); + break; + case CACHE_TYPE_NORMAL: + cachepath = BLI_strdupcat(path, "normal_"); + break; + case CACHE_TYPE_DISPLACE: + default: + cachepath = BLI_strdupcat(path, "disp_"); + break; + } + + BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE); + + MEM_freeN(cachepath); +} + +void BKE_free_ocean_cache(struct OceanCache *och) +{ + int i, f=0; + + if (!och) return; + + if (och->ibufs_disp) { + for (i=och->start, f=0; i<=och->end; i++, f++) + { + if (och->ibufs_disp[f]) { + IMB_freeImBuf(och->ibufs_disp[f]); + } + } + MEM_freeN(och->ibufs_disp); + } + + if (och->ibufs_foam) { + for (i=och->start, f=0; i<=och->end; i++, f++) + { + if (och->ibufs_foam[f]) { + IMB_freeImBuf(och->ibufs_foam[f]); + } + } + MEM_freeN(och->ibufs_foam); + } + + if (och->ibufs_norm) { + for (i=och->start, f=0; i<=och->end; i++, f++) + { + if (och->ibufs_norm[f]) { + IMB_freeImBuf(och->ibufs_norm[f]); + } + } + MEM_freeN(och->ibufs_norm); + } + + if (och->time) + MEM_freeN(och->time); + MEM_freeN(och); +} + +void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v) +{ + int res_x = och->resolution_x; + int res_y = och->resolution_y; + float result[4]; + + u = fmod(u, 1.0); + v = fmod(v, 1.0); + + if (u < 0) u += 1.0f; + if (v < 0) v += 1.0f; + + if (och->ibufs_disp[f]) { + ibuf_sample(och->ibufs_disp[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ocr->disp[0] = result[0]; + ocr->disp[1] = result[1]; + ocr->disp[2] = result[2]; + } + + if (och->ibufs_foam[f]) { + ibuf_sample(och->ibufs_foam[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ocr->foam = result[0]; + } + + if (och->ibufs_norm[f]) { + ibuf_sample(och->ibufs_norm[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ocr->normal[0] = result[0]; + ocr->normal[1] = result[1]; + ocr->normal[2] = result[2]; + } +} + +void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j) +{ + int res_x = och->resolution_x; + int res_y = och->resolution_y; + + i = abs(i) % res_x; + j = abs(j) % res_y; + + if (och->ibufs_disp[f]) { + ocr->disp[0] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 0]; + ocr->disp[1] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 1]; + ocr->disp[2] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 2]; + } + + if (och->ibufs_foam[f]) { + ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i) + 0]; + } + + if (och->ibufs_norm[f]) { + ocr->normal[0] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 0]; + ocr->normal[1] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 1]; + ocr->normal[2] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 2]; + } +} + +struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, + float chop_amount, float foam_coverage, float foam_fade, int resolution) +{ + OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); + + och->bakepath = bakepath; + och->start = start; + och->end = end; + och->duration = (end - start) + 1; + och->wave_scale = wave_scale; + och->chop_amount = chop_amount; + och->foam_coverage = foam_coverage; + och->foam_fade = foam_fade; + och->resolution_x = resolution*resolution; + och->resolution_y = resolution*resolution; + + och->ibufs_disp = MEM_callocN(sizeof(ImBuf *)*och->duration, "displacement imbuf pointer array"); + och->ibufs_foam = MEM_callocN(sizeof(ImBuf *)*och->duration, "foam imbuf pointer array"); + och->ibufs_norm = MEM_callocN(sizeof(ImBuf *)*och->duration, "normal imbuf pointer array"); + + och->time = NULL; + + return och; +} + +void BKE_simulate_ocean_cache(struct OceanCache *och, int frame) +{ + char string[FILE_MAX]; + int f = frame; + + /* ibufs array is zero based, but filenames are based on frame numbers */ + /* still need to clamp frame numbers to valid range of images on disk though */ + CLAMP(frame, och->start, och->end); + f = frame - och->start; // shift to 0 based + + /* if image is already loaded in mem, return */ + if (och->ibufs_disp[f] != NULL ) return; + + + cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE); + och->ibufs_disp[f] = IMB_loadiffname(string, 0); + //if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string); + //else printf("loaded cache %s \n", string); + + cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM); + och->ibufs_foam[f] = IMB_loadiffname(string, 0); + //if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string); + //else printf("loaded cache %s \n", string); + + cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL); + och->ibufs_norm[f] = IMB_loadiffname(string, 0); + //if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string); + //else printf("loaded cache %s \n", string); +} + + +void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data) +{ + int f, i=0, x, y, cancel=0; + float progress; + OceanResult ocr; + ImBuf *ibuf_foam, *ibuf_disp, *ibuf_normal; + float *prev_foam; + int res_x = och->resolution_x; + int res_y = och->resolution_y; + char string[FILE_MAX]; + + if (!o) return; + + prev_foam = MEM_callocN(res_x*res_y*sizeof(float), "previous frame foam bake data"); + + BLI_srand(0); + + for (f=och->start, i=0; f<=och->end; f++, i++) { + + /* create a new imbuf to store image for this frame */ + ibuf_foam = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); + ibuf_disp = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); + ibuf_normal = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); + + ibuf_disp->profile = ibuf_foam->profile = ibuf_normal->profile = IB_PROFILE_LINEAR_RGB; + + BKE_simulate_ocean(o, och->time[i], och->wave_scale, och->chop_amount); + + /* add new foam */ + for (y=0; y < res_y; y++) { + for (x=0; x < res_x; x++) { + float r, pr=0.0, foam_result; + float neg_disp, neg_eplus; + + BKE_ocean_eval_ij(o, &ocr, x, y); + + normalize_v3(ocr.normal); + + /* foam */ + ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage); + + /* accumulate previous value for this cell */ + if (i>0) + pr = prev_foam[res_x*y + x]; + + r = BLI_frand(); // randomly reduce foam + + //pr = pr * och->foam_fade; // overall fade + + // remember ocean coord sys is Y up! + // break up the foam where height (Y) is low (wave valley), + // and X and Z displacement is greatest + + /* + vec[0] = ocr.disp[0]; + vec[1] = ocr.disp[2]; + hor_stretch = len_v2(vec); + CLAMP(hor_stretch, 0.0, 1.0); + */ + + neg_disp = ocr.disp[1]<0.0?1.0+ocr.disp[1]:1.0; + neg_disp = neg_disp<0.0?0.0:neg_disp; + + neg_eplus = ocr.Eplus[2]<0.0?1.0+ocr.Eplus[2]:1.0; + neg_eplus = neg_eplus<0.0?0.0:neg_eplus; + + //if (ocr.disp[1] < 0.0 || r > och->foam_fade) + // pr *= och->foam_fade; + + + //pr = pr * (1.0 - hor_stretch) * ocr.disp[1]; + //pr = pr * neg_disp * neg_eplus; + + if (pr < 1.0) pr *=pr; + + pr *= och->foam_fade * (0.75+neg_eplus*0.25); + + + foam_result = pr + ocr.foam; + + prev_foam[res_x*y + x] = foam_result; + + /* add to the image */ + ibuf_disp->rect_float[4*(res_x*y + x) + 0] = ocr.disp[0]; + ibuf_disp->rect_float[4*(res_x*y + x) + 1] = ocr.disp[1]; + ibuf_disp->rect_float[4*(res_x*y + x) + 2] = ocr.disp[2]; + ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 1.0; + + if (o->_do_jacobian) { + ibuf_foam->rect_float[4*(res_x*y + x) + 0] = foam_result; + ibuf_foam->rect_float[4*(res_x*y + x) + 1] = foam_result; + ibuf_foam->rect_float[4*(res_x*y + x) + 2] = foam_result; + ibuf_foam->rect_float[4*(res_x*y + x) + 3] = 1.0; + } + + if (o->_do_normals) { + ibuf_normal->rect_float[4*(res_x*y + x) + 0] = ocr.normal[0]; + ibuf_normal->rect_float[4*(res_x*y + x) + 1] = ocr.normal[1]; + ibuf_normal->rect_float[4*(res_x*y + x) + 2] = ocr.normal[2]; + ibuf_normal->rect_float[4*(res_x*y + x) + 3] = 1.0; + } + + } + } + + /* write the images */ + cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE); + if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec + printf("Cannot save Displacement File Output to %s\n", string); + + if (o->_do_jacobian) { + cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM); + if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec + printf("Cannot save Foam File Output to %s\n", string); + } + + if (o->_do_normals) { + cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL); + if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec + printf("Cannot save Normal File Output to %s\n", string); + } + + IMB_freeImBuf(ibuf_disp); + IMB_freeImBuf(ibuf_foam); + IMB_freeImBuf(ibuf_normal); + + progress = (f - och->start) / (float)och->duration; + + update_cb(update_cb_data, progress, &cancel); + + if (cancel) { + MEM_freeN(prev_foam); + return; + } + } + + MEM_freeN(prev_foam); + och->baked = 1; +} + +#else // WITH_OCEANSIM + +/* stub */ +typedef struct Ocean { +} Ocean; + + +float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage)) { + return 0.0f; +} + +void BKE_ocean_eval_uv(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u),float UNUSED(v)) +{ +} + +// use catmullrom interpolation rather than linear +void BKE_ocean_eval_uv_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u),float UNUSED(v)) +{ +} + +void BKE_ocean_eval_xz(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x),float UNUSED(z)) +{ +} + +void BKE_ocean_eval_xz_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x),float UNUSED(z)) +{ +} + +void BKE_ocean_eval_ij(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), int UNUSED(i),int UNUSED(j)) +{ +} + +void BKE_simulate_ocean(struct Ocean *UNUSED(o), float UNUSED(t), float UNUSED(scale), float UNUSED(chop_amount)) +{ +} + +struct Ocean *BKE_add_ocean(void) +{ + Ocean *oc = MEM_callocN(sizeof(Ocean), "ocean sim data"); + + return oc; +} + +void BKE_init_ocean(struct Ocean* UNUSED(o), int UNUSED(M),int UNUSED(N), float UNUSED(Lx), float UNUSED(Lz), float UNUSED(V), float UNUSED(l), float UNUSED(A), float UNUSED(w), float UNUSED(damp), + float UNUSED(alignment), float UNUSED(depth), float UNUSED(time), short UNUSED(do_height_field), short UNUSED(do_chop), short UNUSED(do_normals), short UNUSED(do_jacobian), int UNUSED(seed)) +{ +} + +void BKE_free_ocean_data(struct Ocean *UNUSED(oc)) +{ +} + +void BKE_free_ocean(struct Ocean *oc) +{ + if(!oc) return; + MEM_freeN(oc); +} + + +/* ********* Baking/Caching ********* */ + + +void BKE_free_ocean_cache(struct OceanCache *och) +{ + if (!och) return; + + MEM_freeN(och); +} + +void BKE_ocean_cache_eval_uv(struct OceanCache *UNUSED(och), struct OceanResult *UNUSED(ocr), int UNUSED(f), float UNUSED(u), float UNUSED(v)) +{ +} + +void BKE_ocean_cache_eval_ij(struct OceanCache *UNUSED(och), struct OceanResult *UNUSED(ocr), int UNUSED(f), int UNUSED(i), int UNUSED(j)) +{ +} + +struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale), + float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution)) +{ + OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); + + return och; +} + +void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), int UNUSED(frame)) +{ +} + +void BKE_bake_ocean(struct Ocean *UNUSED(o), struct OceanCache *UNUSED(och), void (*update_cb)(void *, float progress, int *cancel), void *UNUSED(update_cb_data)) +{ + /* unused */ + (void)update_cb; +} +#endif // WITH_OCEANSIM diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index c80b2880d12..fcaeacd2eb4 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -60,6 +60,7 @@ #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_ocean.h" #include "BKE_library.h" #include "BKE_image.h" @@ -71,6 +72,7 @@ #include "BKE_animsys.h" #include "BKE_colortools.h" + /* ------------------------------------------------------------------------- */ /* All support for plugin textures: */ @@ -546,6 +548,7 @@ void free_texture(Tex *tex) if(tex->env) BKE_free_envmap(tex->env); if(tex->pd) BKE_free_pointdensity(tex->pd); if(tex->vd) BKE_free_voxeldata(tex->vd); + if(tex->ot) BKE_free_oceantex(tex->ot); BKE_free_animdata((struct ID *)tex); BKE_previewimg_free(&tex->preview); @@ -628,6 +631,11 @@ void default_tex(Tex *tex) tex->vd->interp_type=TEX_VD_LINEAR; tex->vd->file_format=TEX_VD_SMOKE; } + + if (tex->ot) { + tex->ot->output = TEX_OCN_DISPLACEMENT; + tex->ot->object = NULL; + } pit = tex->plugin; if (pit) { varstr= pit->varstr; @@ -662,6 +670,10 @@ void tex_set_type(Tex *tex, int type) if (tex->env == NULL) tex->env = BKE_add_envmap(); break; + case TEX_OCEAN: + if (tex->ot == NULL) + tex->ot = BKE_add_oceantex(); + break; } tex->type = type; @@ -826,6 +838,7 @@ Tex *copy_texture(Tex *tex) if(texn->env) texn->env= BKE_copy_envmap(texn->env); if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd); if(texn->vd) texn->vd= MEM_dupallocN(texn->vd); + if(texn->ot) texn->ot= BKE_copy_oceantex(texn->ot); if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview); if(tex->nodetree) { @@ -864,6 +877,9 @@ Tex *localize_texture(Tex *tex) if(texn->vd->dataset) texn->vd->dataset= MEM_dupallocN(texn->vd->dataset); } + if(texn->ot) { + texn->ot= BKE_copy_oceantex(tex->ot); + } texn->preview = NULL; @@ -1039,7 +1055,7 @@ void autotexname(Tex *tex) Main *bmain= G.main; char texstr[20][15]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend", "Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave", - "Voronoi", "DistNoise", "Point Density", "Voxel Data", "", "", "", ""}; + "Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""}; Image *ima; char di[FILE_MAXDIR], fi[FILE_MAXFILE]; @@ -1469,6 +1485,7 @@ void BKE_free_pointdensity(PointDensity *pd) MEM_freeN(pd); } +/* ------------------------------------------------------------------------- */ void BKE_free_voxeldatadata(struct VoxelData *vd) { @@ -1513,6 +1530,31 @@ struct VoxelData *BKE_copy_voxeldata(struct VoxelData *vd) return vdn; } +/* ------------------------------------------------------------------------- */ + +struct OceanTex *BKE_add_oceantex(void) +{ + OceanTex *ot; + + ot= MEM_callocN(sizeof(struct OceanTex), "ocean texture"); + ot->output = TEX_OCN_DISPLACEMENT; + ot->object = NULL; + + return ot; +} + +struct OceanTex *BKE_copy_oceantex(struct OceanTex *ot) +{ + OceanTex *otn= MEM_dupallocN(ot); + + return otn; +} + +void BKE_free_oceantex(struct OceanTex *ot) +{ + MEM_freeN(ot); +} + /* ------------------------------------------------------------------------- */ int BKE_texture_dependsOnTime(const struct Tex *texture) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3fd661a52da..9e3feedc5d9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -120,6 +120,7 @@ #include "BKE_modifier.h" #include "BKE_multires.h" #include "BKE_node.h" // for tree type defines +#include "BKE_ocean.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_particle.h" @@ -3101,6 +3102,8 @@ static void lib_link_texture(FileData *fd, Main *main) if(tex->pd) tex->pd->object= newlibadr(fd, tex->id.lib, tex->pd->object); if(tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object); + if(tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object); + if(tex->nodetree) lib_link_ntree(fd, &tex->id, tex->nodetree); @@ -3152,6 +3155,8 @@ static void direct_link_texture(FileData *fd, Tex *tex) tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData"); } + tex->ot= newdataadr(fd, tex->ot); + tex->nodetree= newdataadr(fd, tex->nodetree); if(tex->nodetree) direct_link_nodetree(fd, tex->nodetree); @@ -4368,6 +4373,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) SWITCH_INT(mmd->bindcos[a]) } } + else if (md->type==eModifierType_Ocean) { + OceanModifierData *omd = (OceanModifierData*) md; + omd->oceancache = NULL; + omd->ocean = NULL; + omd->refresh = (MOD_OCEAN_REFRESH_ADD|MOD_OCEAN_REFRESH_RESET|MOD_OCEAN_REFRESH_SIM); + } else if (md->type==eModifierType_Warp) { WarpModifierData *tmd = (WarpModifierData *) md; @@ -11846,6 +11857,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + + /* put compatibility code here until next subversion bump */ + if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) { + Object *ob; + Tex *tex; + + + /* ocean res is now squared, reset old ones - will be massive */ + for(ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + for(md= ob->modifiers.first; md; md= md->next) { + if (md->type == eModifierType_Ocean) { + OceanModifierData *omd = (OceanModifierData *)md; + omd->resolution = 7; + omd->oceancache = NULL; + } + } + } + } + + /* put compatibility code here until next subversion bump */ if (main->versionfile < 256) { bScreen *sc; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 11a80d0d41a..2bb70ce20b5 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1815,6 +1815,7 @@ static void write_textures(WriteData *wd, ListBase *idbase) if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve); } if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd); + if(tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot); /* nodetree is integral part of texture, no libdata */ if(tex->nodetree) { diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index a6e8d4a0a3a..185d8d43765 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -159,6 +159,7 @@ void OBJECT_OT_multires_external_save(struct wmOperatorType *ot); void OBJECT_OT_multires_external_pack(struct wmOperatorType *ot); void OBJECT_OT_meshdeform_bind(struct wmOperatorType *ot); void OBJECT_OT_explode_refresh(struct wmOperatorType *ot); +void OBJECT_OT_ocean_bake(struct wmOperatorType *ot); /* object_constraint.c */ void OBJECT_OT_constraint_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index ad2280baba2..af9e6592eb5 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_anim_types.h" #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_mesh_types.h" @@ -48,6 +49,7 @@ #include "BLI_editVert.h" #include "BLI_utildefines.h" +#include "BKE_animsys.h" #include "BKE_curve.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -63,6 +65,7 @@ #include "BKE_multires.h" #include "BKE_report.h" #include "BKE_object.h" +#include "BKE_ocean.h" #include "BKE_particle.h" #include "BKE_softbody.h" @@ -1404,3 +1407,219 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot) edit_modifier_properties(ot); } + +/****************** ocean bake operator *********************/ + +static int ocean_bake_poll(bContext *C) +{ + return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0); +} + +/* copied from init_ocean_modifier, MOD_ocean.c */ +static void init_ocean_modifier_bake(struct Ocean *oc, struct OceanModifierData *omd) +{ + int do_heightfield, do_chop, do_normals, do_jacobian; + + if (!omd || !oc) return; + + do_heightfield = TRUE; + do_chop = (omd->chop_amount > 0); + do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); + do_jacobian = (omd->flag & MOD_OCEAN_GENERATE_FOAM); + + BKE_init_ocean(oc, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size, + omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment, + omd->depth, omd->time, + do_heightfield, do_chop, do_normals, do_jacobian, + omd->seed); +} + +typedef struct OceanBakeJob { + /* from wmJob */ + void *owner; + short *stop, *do_update; + float *progress; + int current_frame; + struct OceanCache *och; + struct Ocean *ocean; + struct OceanModifierData *omd; +} OceanBakeJob; + +static void oceanbake_free(void *customdata) +{ + OceanBakeJob *oj= customdata; + MEM_freeN(oj); +} + +/* called by oceanbake, only to check job 'stop' value */ +static int oceanbake_breakjob(void *UNUSED(customdata)) +{ + //OceanBakeJob *ob= (OceanBakeJob *)customdata; + //return *(ob->stop); + + /* this is not nice yet, need to make the jobs list template better + * for identifying/acting upon various different jobs */ + /* but for now we'll reuse the render break... */ + return (G.afbreek); +} + +/* called by oceanbake, wmJob sends notifier */ +static void oceanbake_update(void *customdata, float progress, int *cancel) +{ + OceanBakeJob *oj= customdata; + + if (oceanbake_breakjob(oj)) + *cancel = 1; + + *(oj->do_update)= 1; + *(oj->progress)= progress; +} + +static void oceanbake_startjob(void *customdata, short *stop, short *do_update, float *progress) +{ + OceanBakeJob *oj= customdata; + + oj->stop= stop; + oj->do_update = do_update; + oj->progress = progress; + + G.afbreek= 0; /* XXX shared with render - replace with job 'stop' switch */ + + BKE_bake_ocean(oj->ocean, oj->och, oceanbake_update, (void *)oj); + + *do_update= 1; + *stop = 0; +} + +static void oceanbake_endjob(void *customdata) +{ + OceanBakeJob *oj= customdata; + + if (oj->ocean) { + BKE_free_ocean(oj->ocean); + oj->ocean = NULL; + } + + oj->omd->oceancache = oj->och; + oj->omd->cached = TRUE; +} + +static int ocean_bake_exec(bContext *C, wmOperator *op) +{ + Object *ob = ED_object_active_context(C); + OceanModifierData *omd = (OceanModifierData *)edit_modifier_property_get(op, ob, eModifierType_Ocean); + Scene *scene = CTX_data_scene(C); + OceanCache *och; + struct Ocean *ocean; + int f, cfra, i=0; + int free= RNA_boolean_get(op->ptr, "free"); + + wmJob *steve; + OceanBakeJob *oj; + + if (!omd) + return OPERATOR_CANCELLED; + + if (free) { + omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE; + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + return OPERATOR_FINISHED; + } + + och = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, + omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); + + och->time = MEM_mallocN(och->duration*sizeof(float), "foam bake time"); + + cfra = scene->r.cfra; + + /* precalculate time variable before baking */ + for (f=omd->bakestart; f<=omd->bakeend; f++) { + /* from physics_fluid.c: + + * XXX: This can't be used due to an anim sys optimisation that ignores recalc object animation, + * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ ) + * --> BKE_animsys_evaluate_all_animation(G.main, eval_time); + * This doesn't work with drivers: + * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL); + */ + + /* Modifying the global scene isn't nice, but we can do it in + * this part of the process before a threaded job is created */ + + //scene->r.cfra = f; + //ED_update_for_newframe(CTX_data_main(C), scene, CTX_wm_screen(C), 1); + + /* ok, this doesn't work with drivers, but is way faster. + * let's use this for now and hope nobody wants to drive the time value... */ + BKE_animsys_evaluate_animdata(scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM); + + och->time[i] = omd->time; + i++; + } + + /* make a copy of ocean to use for baking - threadsafety */ + ocean = BKE_add_ocean(); + init_ocean_modifier_bake(ocean, omd); + + /* + BKE_bake_ocean(ocean, och); + + omd->oceancache = och; + omd->cached = TRUE; + + scene->r.cfra = cfra; + + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + */ + + /* job stuff */ + + scene->r.cfra = cfra; + + /* setup job */ + steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS); + oj= MEM_callocN(sizeof(OceanBakeJob), "ocean bake job"); + oj->ocean = ocean; + oj->och = och; + oj->omd = omd; + + WM_jobs_customdata(steve, oj, oceanbake_free); + WM_jobs_timer(steve, 0.1, NC_OBJECT|ND_MODIFIER, NC_OBJECT|ND_MODIFIER); + WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob); + + WM_jobs_start(CTX_wm_manager(C), steve); + + + + return OPERATOR_FINISHED; +} + +static int ocean_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + if (edit_modifier_invoke_properties(C, op)) + return ocean_bake_exec(C, op); + else + return OPERATOR_CANCELLED; +} + + +void OBJECT_OT_ocean_bake(wmOperatorType *ot) +{ + ot->name= "Bake Ocean"; + ot->description= "Bake an image sequence of ocean data"; + ot->idname= "OBJECT_OT_ocean_bake"; + + ot->poll= ocean_bake_poll; + ot->invoke= ocean_bake_invoke; + ot->exec= ocean_bake_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + edit_modifier_properties(ot); + + RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it"); +} + diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 2df49570ee4..56c75331d48 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -142,6 +142,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_multires_external_pack); WM_operatortype_append(OBJECT_OT_meshdeform_bind); WM_operatortype_append(OBJECT_OT_explode_refresh); + WM_operatortype_append(OBJECT_OT_ocean_bake); WM_operatortype_append(OBJECT_OT_constraint_add); WM_operatortype_append(OBJECT_OT_constraint_add_with_targets); diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 20001ea6cb6..aec984cda34 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -75,6 +75,7 @@ typedef enum ModifierType { eModifierType_WeightVGProximity, eModifierType_EmptySlot, /* keep so DynamicPaint keep loading, can re-use later */ eModifierType_DynamicPaint, /* reserve slot */ + eModifierType_Ocean, NUM_MODIFIER_TYPES } ModifierType; @@ -750,6 +751,64 @@ typedef struct ScrewModifierData { #define MOD_SCREW_OBJECT_OFFSET (1<<2) // #define MOD_SCREW_OBJECT_ANGLE (1<<4) +typedef struct OceanModifierData { + ModifierData modifier; + + struct Ocean *ocean; + struct OceanCache *oceancache; + + int resolution; + int spatial_size; + + float wind_velocity; + + float damp; + float smallest_wave; + float depth; + + float wave_alignment; + float wave_direction; + float wave_scale; + + float chop_amount; + float foam_coverage; + float time; + + int seed; + int flag; + int output; + + int refresh; + + int bakestart; + int bakeend; + + char cachepath[240]; // FILE_MAX + int cached; + + int geometry_mode; + float size; + int repeat_x; + int repeat_y; + + float foam_fade; + +} OceanModifierData; + +#define MOD_OCEAN_GEOM_GENERATE 0 +#define MOD_OCEAN_GEOM_DISPLACE 1 +#define MOD_OCEAN_GEOM_SIM_ONLY 2 + +#define MOD_OCEAN_REFRESH_RESET 1 +#define MOD_OCEAN_REFRESH_SIM 2 +#define MOD_OCEAN_REFRESH_ADD 4 +#define MOD_OCEAN_REFRESH_CLEAR_CACHE 8 +#define MOD_OCEAN_REFRESH_TOPOLOGY 16 + +#define MOD_OCEAN_GENERATE_FOAM 1 +#define MOD_OCEAN_GENERATE_NORMALS 2 + + typedef struct WarpModifierData { ModifierData modifier; diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 1ecca5a0b2a..ece99c8fc86 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -50,6 +50,7 @@ struct Tex; struct Image; struct PreviewImage; struct ImBuf; +struct Ocean; struct CurveMapping; typedef struct MTex { @@ -206,6 +207,15 @@ typedef struct VoxelData { } VoxelData; +typedef struct OceanTex { + struct Object *object; + char oceanmod[64]; + + int output; + int pad; + +} OceanTex; + typedef struct Tex { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -261,6 +271,7 @@ typedef struct Tex { struct PreviewImage * preview; struct PointDensity *pd; struct VoxelData *vd; + struct OceanTex *ot; char use_nodes; char pad[7]; @@ -318,6 +329,7 @@ typedef struct ColorMapping { #define TEX_DISTNOISE 13 #define TEX_POINTDENSITY 14 #define TEX_VOXELDATA 15 +#define TEX_OCEAN 16 /* musgrave stype */ #define TEX_MFRACTAL 0 @@ -588,6 +600,18 @@ typedef struct ColorMapping { #define TEX_VD_SMOKEHEAT 1 #define TEX_VD_SMOKEVEL 2 +/******************** Ocean *****************************/ +/* output */ +#define TEX_OCN_DISPLACEMENT 1 +#define TEX_OCN_FOAM 2 +#define TEX_OCN_JPLUS 3 +#define TEX_OCN_EMINUS 4 +#define TEX_OCN_EPLUS 5 + +/* flag */ +#define TEX_OCN_GENERATE_NORMALS 1 +#define TEX_OCN_XZ 2 + #ifdef __cplusplus } #endif diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index c9dadce0a5e..08e3d1a72a2 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -348,6 +348,9 @@ extern StructRNA RNA_NorController; extern StructRNA RNA_Object; extern StructRNA RNA_ObjectBase; extern StructRNA RNA_ObstacleFluidSettings; +extern StructRNA RNA_OceanModifier; +extern StructRNA RNA_OceanTexData; +extern StructRNA RNA_OceanTexture; extern StructRNA RNA_Operator; extern StructRNA RNA_OperatorFileListElement; extern StructRNA RNA_OperatorMousePath; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 769ec880a65..9eea6d83cb9 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -55,6 +55,9 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') +if env['WITH_BF_OCEANSIM']: + defs.append('WITH_OCEANSIM') + if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 9bc532afa11..e50617f220c 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -206,6 +206,10 @@ if(WITH_FFTW3) add_definitions(-DWITH_FFTW3) endif() +if(WITH_OCEANSIM) + add_definitions(-DWITH_OCEANSIM) +endif() + if(WITH_SDL) add_definitions(-DWITH_SDL) endif() diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 32665bef065..aed5ba8840b 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -96,6 +96,7 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""}, {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""}, + {eModifierType_Ocean, "OCEAN", ICON_MOD_WAVE, "Ocean", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -186,6 +187,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_SolidifyModifier; case eModifierType_Screw: return &RNA_ScrewModifier; + case eModifierType_Ocean: + return &RNA_OceanModifier; case eModifierType_Warp: return &RNA_WarpModifier; case eModifierType_WeightVGEdit: @@ -649,6 +652,57 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value) md->projectors[a]= NULL; } +static int rna_OceanModifier_build_enabled_get(PointerRNA *UNUSED(ptr)) +{ + #ifdef WITH_OCEANSIM + return 1; + #else // WITH_OCEANSIM + return 0; + #endif // WITH_OCEANSIM +} + +static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + OceanModifierData *omd= (OceanModifierData*)ptr->data; + + omd->refresh |= (MOD_OCEAN_REFRESH_RESET|MOD_OCEAN_REFRESH_SIM|MOD_OCEAN_REFRESH_CLEAR_CACHE); + + rna_Modifier_update(bmain, scene, ptr); +} + +static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + OceanModifierData *omd= (OceanModifierData*)ptr->data; + + omd->refresh |= MOD_OCEAN_REFRESH_SIM; + + rna_Modifier_update(bmain, scene, ptr); +} + +static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + OceanModifierData *omd= (OceanModifierData*)ptr->data; + + omd->refresh |= MOD_OCEAN_REFRESH_TOPOLOGY; + + rna_Modifier_update(bmain, scene, ptr); +} + +static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value) +{ + OceanModifierData *omd= (OceanModifierData*)ptr->data; + float old_value = omd->chop_amount; + + omd->chop_amount = value; + + if ((old_value == 0.0 && value > 0.0) || + (old_value > 0.0 && value == 0.0)) + { + omd->refresh |= MOD_OCEAN_REFRESH_RESET; + omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE; + } +} + static float rna_EdgeSplitModifier_split_angle_get(PointerRNA *ptr) { EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data; @@ -2809,6 +2863,181 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) rna_def_modifier_weightvg_mask(brna, srna); } +static void rna_def_modifier_ocean(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem geometry_items[]= { + {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generates ocean surface geometry at the specified resolution"}, + {MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displaces existing geometry according to simulation"}, + //{MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only", "Leaves geometry unchanged, but still runs simulation (to be used from texture)"}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "OceanModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Ocean Modifier", "Simulate an ocean surface"); + RNA_def_struct_sdna(srna, "OceanModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); + + /* General check if OceanSim modifier code is enabled */ + prop= RNA_def_property(srna, "build_enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_OceanModifier_build_enabled_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Build Enabled", "True if the OceanSim modifier is enabled in this build"); + + prop= RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "geometry_mode"); + RNA_def_property_enum_items(prop, geometry_items); + RNA_def_property_ui_text(prop, "Geometry", "Method of modifying geometry"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Size", ""); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); + RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update"); + + prop= RNA_def_property(srna, "repeat_x", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "repeat_x"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 1, 1024); + RNA_def_property_ui_range(prop, 1, 100, 1, 0); + RNA_def_property_ui_text(prop, "Repeat X", "Repetitions of the generated surface in X"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update"); + + prop= RNA_def_property(srna, "repeat_y", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "repeat_y"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 1, 1024); + RNA_def_property_ui_range(prop, 1, 100, 1, 0); + RNA_def_property_ui_text(prop, "Repeat Y", "Repetitions of the generated surface in Y"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update"); + + prop= RNA_def_property(srna, "generate_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Generate Normals", "Outputs normals for bump mapping - disabling can speed up performance if its not needed"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "generate_foam", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Generate Foam", "Generates foam mask as a vertex color channel"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "resolution"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 1, 1024); + RNA_def_property_ui_range(prop, 1, 32, 1, 0); + RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "spatial_size", PROP_INT, PROP_DISTANCE); + RNA_def_property_int_sdna(prop, NULL, "spatial_size"); + RNA_def_property_ui_range(prop, 1, 512, 2, 0); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Spatial Size", "Physical size of the simulation domain (m)"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_float_sdna(prop, NULL, "wind_velocity"); + RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed (m/s)"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "damp"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Damping", "Damp reflected waves going in opposite direction to the wind"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "smallest_wave", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "smallest_wave"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 0.0, FLT_MAX); + RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength (m)"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "wave_alignment"); + RNA_def_property_range(prop, 0.0, 10.0); + RNA_def_property_ui_text(prop, "Wave Alignment", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "wave_direction"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Wave Direction", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "wave_scale"); + RNA_def_property_ui_text(prop, "Wave Scale", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); + + prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "depth"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Depth", ""); + RNA_def_property_ui_range(prop, 0, 250, 1, 0); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "foam_coverage"); + RNA_def_property_ui_text(prop, "Foam Coverage", ""); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "foam_fade"); + RNA_def_property_ui_text(prop, "Foam Fade", ""); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); + RNA_def_property_update(prop, 0, NULL); + + prop= RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "chop_amount"); + RNA_def_property_ui_text(prop, "Choppiness", ""); + RNA_def_property_ui_range(prop, 0.0, 4.0, 3, 0); + RNA_def_property_float_funcs(prop, NULL, "rna_OceanModifier_ocean_chop_set", NULL); + RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); + + prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "time"); + RNA_def_property_ui_text(prop, "Time", ""); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); + RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); + + prop= RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "seed"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Random Seed", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "bake_start", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "bakestart"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Bake Start", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "bake_end", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "bakeend"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Bake End", ""); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop= RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cached", 1); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is useing cached data or simulating"); + + + prop= RNA_def_property(srna, "cachepath", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_sdna(prop, NULL, "cachepath"); + RNA_def_property_ui_text(prop, "Cache Path", "Path to a folder to store external baked images"); + //RNA_def_property_update(prop, 0, "rna_Modifier_update"); + // XXX how to update? +} + + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -2910,6 +3139,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_weightvgmix(brna); rna_def_modifier_weightvgproximity(brna); rna_def_modifier_dynamic_paint(brna); + rna_def_modifier_ocean(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index aac4da9e6f6..249bdb4a366 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -73,6 +73,7 @@ EnumPropertyItem texture_type_items[] = { {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - Create cell-like patterns based on Worley noise"}, {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Create a 3d texture based on volumetric data"}, {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - Wave generated bands or rings, with optional noise"}, + {TEX_OCEAN, "OCEAN", ICON_TEXTURE, "Ocean", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem blend_type_items[] = { @@ -145,6 +146,8 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) return &RNA_VoxelDataTexture; case TEX_WOOD: return &RNA_WoodTexture; + case TEX_OCEAN: + return &RNA_OceanTexture; default: return &RNA_Texture; } @@ -435,6 +438,11 @@ static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr)) return BLI_sprintfN("voxel_data"); } +static char *rna_OceanTex_path(PointerRNA *ptr) +{ + return BLI_sprintfN("ocean"); +} + #else static void rna_def_texmapping(BlenderRNA *brna) @@ -1860,6 +1868,49 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update"); } +static void rna_def_texture_ocean(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem ocean_output_items[] = { + {TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Outputs XYZ displacement in RGB channels"}, + //{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"}, // these are in nor channel now + {TEX_OCN_FOAM, "FOAM", 0, "Foam", "Outputs Foam (wave overlap) amount in single channel"}, + {TEX_OCN_JPLUS, "JPLUS", 0, "Eigenvalues", "Positive Eigenvalues"}, + {TEX_OCN_EMINUS, "EMINUS", 0, "Eigenvectors (-)", "Negative Eigenvectors"}, + {TEX_OCN_EPLUS, "EPLUS", 0, "Eigenvectors (+)", "Positive Eigenvectors"}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "OceanTexData", NULL); + RNA_def_struct_sdna(srna, "OceanTex"); + RNA_def_struct_ui_text(srna, "Ocean", "Ocean Texture settings"); + RNA_def_struct_path_func(srna, "rna_OceanTex_path"); + + prop= RNA_def_property(srna, "output", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "output"); + RNA_def_property_enum_items(prop, ocean_output_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Output", "The data that is output by the texture"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); + + prop= RNA_def_property(srna, "ocean_object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_ui_text(prop, "Modifier Object", "Object containing the ocean modifier"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, 0, "rna_Texture_update"); + + srna= RNA_def_struct(brna, "OceanTexture", "Texture"); + RNA_def_struct_sdna(srna, "Tex"); + RNA_def_struct_ui_text(srna, "Ocean", "Settings for the Ocean texture"); + + prop= RNA_def_property(srna, "ocean", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "ot"); + RNA_def_property_struct_type(prop, "OceanTexData"); + RNA_def_property_ui_text(prop, "Ocean", "The ocean data associated with this texture"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); +} + static void rna_def_texture(BlenderRNA *brna) { StructRNA *srna; @@ -1962,6 +2013,7 @@ static void rna_def_texture(BlenderRNA *brna) rna_def_texture_distorted_noise(brna); rna_def_texture_pointdensity(brna); rna_def_texture_voxeldata(brna); + rna_def_texture_ocean(brna); /* XXX add more types here .. */ RNA_api_texture(srna); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index e8ecc75ca60..4aedb4ae7a8 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -67,6 +67,7 @@ set(SRC intern/MOD_mirror.c intern/MOD_multires.c intern/MOD_none.c + intern/MOD_ocean.c intern/MOD_particleinstance.c intern/MOD_particlesystem.c intern/MOD_screw.c @@ -116,6 +117,10 @@ if(WITH_MOD_FLUID) add_definitions(-DWITH_MOD_FLUID) endif() +if(WITH_OCEANSIM) + add_definitions(-DWITH_OCEANSIM) +endif() + if(WITH_GAMEENGINE) # for MOD_navmesh.c add_definitions(-DWITH_GAMEENGINE) @@ -125,4 +130,8 @@ if(WITH_GAMEENGINE) ) endif() +if(WITH_OPENMP) + add_definitions(-DPARALLEL=1) +endif() + blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index 8ffb7803bb1..cc077694384 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -69,6 +69,7 @@ extern ModifierTypeInfo modifierType_Smoke; extern ModifierTypeInfo modifierType_ShapeKey; extern ModifierTypeInfo modifierType_Solidify; extern ModifierTypeInfo modifierType_Screw; +extern ModifierTypeInfo modifierType_Ocean; extern ModifierTypeInfo modifierType_Warp; extern ModifierTypeInfo modifierType_NavMesh; extern ModifierTypeInfo modifierType_WeightVGEdit; diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 277ed2c3fb3..8273ab0d1fe 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -22,6 +22,9 @@ if env ['WITH_BF_DECIMATE']: if env['WITH_BF_FLUID']: defs.append('WITH_MOD_FLUID') +if env['WITH_BF_OCEANSIM']: + defs.append('WITH_OCEANSIM') + if env['WITH_BF_GAMEENGINE']: incs += ' #/extern/recastnavigation' defs.append('WITH_GAMEENGINE') diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c new file mode 100644 index 00000000000..f36d3674913 --- /dev/null +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -0,0 +1,561 @@ +/** + * $Id: MOD_ocean.c 28135 2010-04-11 23:20:03Z gsrb3d $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) Blender Foundation + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "MEM_guardedalloc.h" + +#include "DNA_customdata_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" +#include "DNA_scene_types.h" + +#include "BKE_cdderivedmesh.h" +#include "BKE_modifier.h" +#include "BKE_ocean.h" +#include "BKE_utildefines.h" + +#include "BLI_math.h" +#include "BLI_math_inline.h" +#include "BLI_utildefines.h" + +#include "MOD_util.h" + +#ifdef WITH_OCEANSIM +static void init_cache_data(struct OceanModifierData *omd) +{ + omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, + omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); +} + +static void clear_cache_data(struct OceanModifierData *omd) +{ + BKE_free_ocean_cache(omd->oceancache); + omd->oceancache = NULL; + omd->cached = FALSE; +} + +/* keep in sync with init_ocean_modifier_bake(), object_modifier.c */ +static void init_ocean_modifier(struct OceanModifierData *omd) +{ + int do_heightfield, do_chop, do_normals, do_jacobian; + + if (!omd || !omd->ocean) return; + + do_heightfield = TRUE; + do_chop = (omd->chop_amount > 0); + do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); + do_jacobian = (omd->flag & MOD_OCEAN_GENERATE_FOAM); + + BKE_free_ocean_data(omd->ocean); + BKE_init_ocean(omd->ocean, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size, + omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment, + omd->depth, omd->time, + do_heightfield, do_chop, do_normals, do_jacobian, + omd->seed); +} + +static void simulate_ocean_modifier(struct OceanModifierData *omd) +{ + if (!omd || !omd->ocean) return; + + BKE_simulate_ocean(omd->ocean, omd->time, omd->wave_scale, omd->chop_amount); +} +#endif // WITH_OCEANSIM + + + +/* Modifier Code */ + +static void initData(ModifierData *md) +{ +#ifdef WITH_OCEANSIM + OceanModifierData *omd = (OceanModifierData*) md; + + omd->resolution = 7; + omd->spatial_size = 50; + + omd->wave_alignment = 0.0; + omd->wind_velocity = 30.0; + + omd->damp = 0.5; + omd->smallest_wave = 0.01; + omd->wave_direction= 0.0; + omd->depth = 200.0; + + omd->wave_scale = 1.0; + + omd->chop_amount = 1.0; + + omd->foam_coverage = 0.0; + + omd->seed = 0; + omd->time = 1.0; + + omd->refresh = 0; + + omd->size = 1.0; + omd->repeat_x = 1; + omd->repeat_y = 1; + + strcpy(omd->cachepath, "//ocean_cache/"); + + omd->cached = 0; + omd->bakestart = 1; + omd->bakeend = 250; + omd->oceancache = NULL; + omd->foam_fade = 0.98; + + omd->ocean = BKE_add_ocean(); + init_ocean_modifier(omd); + simulate_ocean_modifier(omd); +#else // WITH_OCEANSIM + /* unused */ + (void)md; +#endif // WITH_OCEANSIM +} + +static void freeData(ModifierData *md) +{ +#ifdef WITH_OCEANSIM + OceanModifierData *omd = (OceanModifierData*) md; + + BKE_free_ocean(omd->ocean); + if (omd->oceancache) + BKE_free_ocean_cache(omd->oceancache); +#else // WITH_OCEANSIM + /* unused */ + (void)md; +#endif // WITH_OCEANSIM +} + +static void copyData(ModifierData *md, ModifierData *target) +{ +#ifdef WITH_OCEANSIM + OceanModifierData *omd = (OceanModifierData*) md; + OceanModifierData *tomd = (OceanModifierData*) target; + + tomd->resolution = omd->resolution; + tomd->spatial_size = omd->spatial_size; + + tomd->wind_velocity = omd->wind_velocity; + + tomd->damp = omd->damp; + tomd->smallest_wave = omd->smallest_wave; + tomd->depth = omd->depth; + + tomd->wave_alignment = omd->wave_alignment; + tomd->wave_direction = omd->wave_direction; + tomd->wave_scale = omd->wave_scale; + + tomd->chop_amount = omd->chop_amount; + tomd->foam_coverage = omd->foam_coverage; + tomd->time = omd->time; + + tomd->seed = omd->seed; + tomd->flag = omd->flag; + tomd->output = omd->output; + + tomd->refresh = 0; + + + tomd->size = omd->size; + tomd->repeat_x = omd->repeat_x; + tomd->repeat_y = omd->repeat_y; + + /* XXX todo: copy cache runtime too */ + tomd->cached = 0; + tomd->bakestart = omd->bakestart; + tomd->bakeend = omd->bakeend; + tomd->oceancache = NULL; + + tomd->ocean = BKE_add_ocean(); + init_ocean_modifier(tomd); + simulate_ocean_modifier(tomd); +#else // WITH_OCEANSIM + /* unused */ + (void)md; + (void)target; +#endif // WITH_OCEANSIM +} + +#ifdef WITH_OCEANSIM +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) +{ + OceanModifierData *omd = (OceanModifierData *)md; + CustomDataMask dataMask = 0; + + if (omd->flag & MOD_OCEAN_GENERATE_FOAM) + dataMask |= CD_MASK_MCOL; + + return dataMask; +} +#else // WITH_OCEANSIM +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) +{ + /* unused */ + (void)md; + return 0; +} +#endif // WITH_OCEANSIM + +#if 0 +static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, float *oy) +{ + /* get bounding box of underlying dm */ + int v, totvert=dm->getNumVerts(dm); + float min[3], max[3], delta[3]; + + MVert *mvert = dm->getVertDataArray(dm,0); + + copy_v3_v3(min, mvert->co); + copy_v3_v3(max, mvert->co); + + for(v=1; vco[0]); + min[1]=MIN2(min[1],mvert->co[1]); + min[2]=MIN2(min[2],mvert->co[2]); + + max[0]=MAX2(max[0],mvert->co[0]); + max[1]=MAX2(max[1],mvert->co[1]); + max[2]=MAX2(max[2],mvert->co[2]); + } + + sub_v3_v3v3(delta, max, min); + + *sx = delta[0]; + *sy = delta[1]; + + *ox = min[0]; + *oy = min[1]; +} +#endif + +#ifdef WITH_OCEANSIM +MINLINE float ocean_co(OceanModifierData *omd, float v) +{ + //float scale = 1.0 / (omd->size * omd->spatial_size); + //*v = (*v * scale) + 0.5; + + return (v / (omd->size * omd->spatial_size)) + 0.5; +} + +#define OMP_MIN_RES 18 +static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) +{ + DerivedMesh *result; + + MVert *mv; + MFace *mf; + MTFace *tf; + + int cdlayer; + + const int rx = omd->resolution*omd->resolution; + const int ry = omd->resolution*omd->resolution; + const int res_x = rx * omd->repeat_x; + const int res_y = ry * omd->repeat_y; + + const int num_verts = (res_x + 1) * (res_y + 1); + const int num_edges = (res_x * res_y * 2) + res_x + res_y; + const int num_faces = res_x * res_y; + + float sx = omd->size * omd->spatial_size; + float sy = omd->size * omd->spatial_size; + const float ox = -sx / 2.0; + const float oy = -sy / 2.0; + + float ix, iy; + + int x, y; + + sx /= rx; + sy /= ry; + + result = CDDM_new(num_verts, num_edges, num_faces); + + mv = CDDM_get_verts(result); + mf = CDDM_get_faces(result); + + /* create vertices */ + #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) + for (y=0; y < res_y+1; y++) { + for (x=0; x < res_x+1; x++) { + const int i = y*(res_x+1) + x; + mv[i].co[0] = ox + (x * sx); + mv[i].co[1] = oy + (y * sy); + mv[i].co[2] = 0; + } + } + + /* create faces */ + #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) + for (y=0; y < res_y; y++) { + for (x=0; x < res_x; x++) { + const int fi = y*res_x + x; + const int vi = y*(res_x+1) + x; + mf[fi].v1 = vi; + mf[fi].v2 = vi + 1; + mf[fi].v3 = vi + 1 + res_x+1; + mf[fi].v4 = vi + res_x+1; + + mf[fi].flag |= ME_SMOOTH; + } + } + + CDDM_calc_edges(result); + + /* add uvs */ + cdlayer= CustomData_number_of_layers(&result->faceData, CD_MTFACE); + if(cdlayer >= MAX_MTFACE) + return result; + CustomData_add_layer(&result->faceData, CD_MTFACE, CD_CALLOC, NULL, num_faces); + tf = CustomData_get_layer(&result->faceData, CD_MTFACE); + + ix = 1.0 / rx; + iy = 1.0 / ry; + #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) + for (y=0; y < res_y; y++) { + for (x=0; x < res_x; x++) { + const int i = y*res_x + x; + tf[i].uv[0][0] = x * ix; + tf[i].uv[0][1] = y * iy; + + tf[i].uv[1][0] = (x+1) * ix; + tf[i].uv[1][1] = y * iy; + + tf[i].uv[2][0] = (x+1) * ix; + tf[i].uv[2][1] = (y+1) * iy; + + tf[i].uv[3][0] = x * ix; + tf[i].uv[3][1] = (y+1) * iy; + } + } + + return result; +} + +static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams)) +{ + OceanModifierData *omd = (OceanModifierData*) md; + + DerivedMesh *dm=NULL; + OceanResult ocr; + + MVert *mv; + MFace *mf; + + int cdlayer; + + int i, j; + + int num_verts; + int num_faces; + + int cfra; + + /* update modifier */ + if (omd->refresh & MOD_OCEAN_REFRESH_ADD) + omd->ocean = BKE_add_ocean(); + if (omd->refresh & MOD_OCEAN_REFRESH_RESET) + init_ocean_modifier(omd); + if (omd->refresh & MOD_OCEAN_REFRESH_CLEAR_CACHE) + clear_cache_data(omd); + + omd->refresh = 0; + + /* do ocean simulation */ + if (omd->cached == TRUE) { + if (!omd->oceancache) init_cache_data(omd); + BKE_simulate_ocean_cache(omd->oceancache, md->scene->r.cfra); + } else { + simulate_ocean_modifier(omd); + } + + if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) + dm = generate_ocean_geometry(omd); + else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) { + dm = CDDM_copy(derivedData); + } + + cfra = md->scene->r.cfra; + CLAMP(cfra, omd->bakestart, omd->bakeend); + cfra -= omd->bakestart; // shift to 0 based + + num_verts = dm->getNumVerts(dm); + num_faces = dm->getNumFaces(dm); + + /* add vcols before displacement - allows lookup based on position */ + + if (omd->flag & MOD_OCEAN_GENERATE_FOAM) { + MCol *mc; + float foam; + char cf; + + float u=0.0, v=0.0; + + cdlayer= CustomData_number_of_layers(&dm->faceData, CD_MCOL); + if(cdlayer >= MAX_MCOL) + return dm; + + CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces); + + mc = dm->getFaceDataArray(dm, CD_MCOL); + mv = dm->getVertArray(dm); + mf = dm->getFaceArray(dm); + + for (i = 0; i < num_faces; i++, mf++) { + for (j=0; j<4; j++) { + + if (j == 3 && !mf->v4) continue; + + switch(j) { + case 0: + u = ocean_co(omd, mv[mf->v1].co[0]); + v = ocean_co(omd, mv[mf->v1].co[1]); + break; + case 1: + u = ocean_co(omd, mv[mf->v2].co[0]); + v = ocean_co(omd, mv[mf->v2].co[1]); + break; + case 2: + u = ocean_co(omd, mv[mf->v3].co[0]); + v = ocean_co(omd, mv[mf->v3].co[1]); + break; + case 3: + u = ocean_co(omd, mv[mf->v4].co[0]); + v = ocean_co(omd, mv[mf->v4].co[1]); + + break; + } + + if (omd->oceancache && omd->cached==TRUE) { + BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); + foam = ocr.foam; + CLAMP(foam, 0.0, 1.0); + } else { + BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); + foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage); + } + + cf = (char)(foam*255); + mc[i*4 + j].r = mc[i*4 + j].g = mc[i*4 + j].b = cf; + mc[i*4 + j].a = 255; + } + } + } + + + /* displace the geometry */ + + mv = dm->getVertArray(dm); + + //#pragma omp parallel for private(i, ocr) if (omd->resolution > OMP_MIN_RES) + for (i=0; i< num_verts; i++) { + const float u = ocean_co(omd, mv[i].co[0]); + const float v = ocean_co(omd, mv[i].co[1]); + + if (omd->oceancache && omd->cached==TRUE) + BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); + else + BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); + + mv[i].co[2] += ocr.disp[1]; + + if (omd->chop_amount > 0.0) { + mv[i].co[0] += ocr.disp[0]; + mv[i].co[1] += ocr.disp[2]; + } + } + + + return dm; +} +#else // WITH_OCEANSIM +static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams)) +{ + /* unused */ + (void)md; + return derivedData; +} +#endif // WITH_OCEANSIM + +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) +{ + DerivedMesh *result; + + result = doOcean(md, ob, derivedData, 0); + + if(result != derivedData) + CDDM_calc_normals(result); + + return result; +} + +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) +{ + return applyModifier(md, ob, derivedData, 0, 1); +} + + + +ModifierTypeInfo modifierType_Ocean = { + /* name */ "Ocean", + /* structName */ "OceanModifierData", + /* structSize */ sizeof(OceanModifierData), + /* type */ eModifierTypeType_Constructive, + /* flags */ eModifierTypeFlag_AcceptsMesh + | eModifierTypeFlag_SupportsEditmode + | eModifierTypeFlag_EnableInEditmode, + + /* copyData */ copyData, + /* deformMatrices */ 0, + /* deformVerts */ 0, + /* deformVertsEM */ 0, + /* deformMatricesEM */ 0, + /* applyModifier */ applyModifier, + /* applyModifierEM */ applyModifierEM, + /* initData */ initData, + /* requiredDataMask */ requiredDataMask, + /* freeData */ freeData, + /* isDisabled */ 0, + /* updateDepgraph */ 0, + /* dependsOnTime */ 0, + /* dependsOnNormals */ 0, + /* foreachObjectLink */ 0, + /* foreachIDLink */ 0, +}; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 38abb96aa7c..01c7f31b67a 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -260,6 +260,7 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(Collision); INIT_TYPE(Boolean); INIT_TYPE(MeshDeform); + INIT_TYPE(Ocean); INIT_TYPE(ParticleSystem); INIT_TYPE(ParticleInstance); INIT_TYPE(Explode); diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 763cd3780fb..c7b27c3cd7e 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -74,6 +74,7 @@ set(SRC intern/source/sss.c intern/source/strand.c intern/source/sunsky.c + intern/source/texture_ocean.c intern/source/volume_precache.c intern/source/volumetric.c intern/source/voxeldata.c @@ -104,6 +105,7 @@ set(SRC intern/include/strand.h intern/include/sunsky.h intern/include/texture.h + intern/include/texture_ocean.h intern/include/volume_precache.h intern/include/volumetric.h intern/include/voxeldata.h diff --git a/source/blender/render/intern/include/texture_ocean.h b/source/blender/render/intern/include/texture_ocean.h new file mode 100644 index 00000000000..b0a0647d115 --- /dev/null +++ b/source/blender/render/intern/include/texture_ocean.h @@ -0,0 +1,28 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributors: Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +void prepare_ocean_tex_modifier(struct OceanTex *ot); + +int ocean_texture(struct Tex *tex, float *texvec, struct TexResult *texres); diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index afc52f7c92a..bd323a5b2d3 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -79,6 +79,7 @@ #include "rendercore.h" #include "shading.h" #include "texture.h" +#include "texture_ocean.h" #include "renderdatabase.h" /* needed for UV */ @@ -1264,7 +1265,9 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, case TEX_VOXELDATA: retval= voxeldatatex(tex, texvec, texres); break; - + case TEX_OCEAN: + retval= ocean_texture(tex, texvec, texres); + break; } if (tex->flag & TEX_COLORBAND) { @@ -2193,6 +2196,12 @@ void do_material_tex(ShadeInput *shi, Render *re) use_ntap_bump = 0; use_compat_bump = 1; } + + /* case ocean */ + if(tex->type == TEX_OCEAN) { + use_ntap_bump = 0; + use_compat_bump = 0; + } /* which coords */ if(mtex->texco==TEXCO_ORCO) { diff --git a/source/blender/render/intern/source/texture_ocean.c b/source/blender/render/intern/source/texture_ocean.c new file mode 100644 index 00000000000..c9d84b23e33 --- /dev/null +++ b/source/blender/render/intern/source/texture_ocean.c @@ -0,0 +1,162 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributors: Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "BLI_math.h" +#include "BLI_utildefines.h" + +#include "DNA_modifier_types.h" +#include "DNA_object_types.h" +#include "DNA_texture_types.h" + +#include "BKE_global.h" /* XXX */ + +#include "BKE_modifier.h" +#include "BKE_ocean.h" +#include "BKE_utildefines.h" + +#include "render_types.h" +#include "RE_shader_ext.h" + +#include "texture.h" + + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* defined in pipeline.c, is hardcopy of active dynamic allocated Render */ +/* only to be used here in this file, it's for speed */ +extern struct Render R; +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + + + +/* ***** actual texture sampling ***** */ +int ocean_texture(Tex *tex, float *texvec, TexResult *texres) +{ + int retval = TEX_INT; + OceanTex *ot= tex->ot; + OceanResult or; + const float u = 0.5+0.5*texvec[0]; + const float v = 0.5+0.5*texvec[1]; + float foam; + int cfra = R.r.cfra; + int normals=0; + ModifierData *md; + + texres->tin = 0.0f; + + if (!ot || !ot->object || !ot->object->modifiers.first) + return 0; + + if ((md = (ModifierData *)modifiers_findByType(ot->object, eModifierType_Ocean))) { + OceanModifierData *omd = (OceanModifierData *)md; + + if (!omd->ocean) + return 0; + + normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); + + if (omd->oceancache && omd->cached==TRUE) { + + CLAMP(cfra, omd->bakestart, omd->bakeend); + cfra -= omd->bakestart; // shift to 0 based + + BKE_ocean_cache_eval_uv(omd->oceancache, &or, cfra, u, v); + + } else { // non-cached + + if (G.rendering) + BKE_ocean_eval_uv_catrom(omd->ocean, &or, u, v); + else + BKE_ocean_eval_uv(omd->ocean, &or, u, v); + + or.foam = BKE_ocean_jminus_to_foam(or.Jminus, omd->foam_coverage); + } + } + + + switch (ot->output) { + case TEX_OCN_DISPLACEMENT: + /* XYZ displacement */ + texres->tr = 0.5 + 0.5 * or.disp[0]; + texres->tg = 0.5 + 0.5 * or.disp[2]; + texres->tb = 0.5 + 0.5 * or.disp[1]; + + texres->tr = MAX2(0.0, texres->tr); + texres->tg = MAX2(0.0, texres->tg); + texres->tb = MAX2(0.0, texres->tb); + + BRICONTRGB; + + retval = TEX_RGB; + break; + + case TEX_OCN_EMINUS: + /* -ve eigenvectors ? */ + texres->tr = or.Eminus[0]; + texres->tg = or.Eminus[2]; + texres->tb = or.Eminus[1]; + retval = TEX_RGB; + break; + + case TEX_OCN_EPLUS: + /* -ve eigenvectors ? */ + texres->tr = or.Eplus[0]; + texres->tg = or.Eplus[2]; + texres->tb = or.Eplus[1]; + retval = TEX_RGB; + break; + + case TEX_OCN_JPLUS: + texres->tin = or.Jplus; + retval = TEX_INT; + case TEX_OCN_FOAM: + + texres->tin = or.foam; + + BRICONT; + + retval = TEX_INT; + break; + } + + /* if normals needed */ + + if (texres->nor && normals) { + + texres->nor[0] = or.normal[0]; + texres->nor[1] = or.normal[2]; + texres->nor[2] = or.normal[1]; + + normalize_v3(texres->nor); + retval |= TEX_NOR; + } + + texres->ta = 1.0; + + return retval; +} + From d0550758afaf963577c07113c387cd67f0ffca52 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 13 Nov 2011 12:25:14 +0000 Subject: [PATCH 009/203] Fix #29048: iTaSC solver crash on certain compilers/platforms, due to memory alignment issues with Eigen. Patch by Tobias Oelgarte. --- intern/itasc/kdl/chain.hpp | 3 ++- intern/itasc/kdl/tree.hpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/intern/itasc/kdl/chain.hpp b/intern/itasc/kdl/chain.hpp index 0d40690202a..a2b4905622e 100644 --- a/intern/itasc/kdl/chain.hpp +++ b/intern/itasc/kdl/chain.hpp @@ -34,7 +34,8 @@ namespace KDL { */ class Chain { private: - std::vector segments; + // Eigen allocator is needed for alignment of Eigen data types + std::vector > segments; unsigned int nrOfJoints; unsigned int nrOfSegments; public: diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp index bdd3aa94572..6b822dcd1e0 100644 --- a/intern/itasc/kdl/tree.hpp +++ b/intern/itasc/kdl/tree.hpp @@ -27,12 +27,14 @@ #include #include +#include namespace KDL { //Forward declaration class TreeElement; - typedef std::map SegmentMap; + // Eigen allocator is needed for alignment of Eigen data types + typedef std::map, Eigen::aligned_allocator > > SegmentMap; class TreeElement { From 4ad04566750d7c5e69374e85b03793e508683a2e Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 13 Nov 2011 12:45:47 +0000 Subject: [PATCH 010/203] Ocean Sim: * Changed the user interface for the Ocean modifier, to use less space and look better. * Changed rna name cachepath to filepath for consistency (fluid cache path also uses "filepath") --- .../startup/bl_ui/properties_data_modifier.py | 83 +++++++++---------- source/blender/makesrna/intern/rna_modifier.c | 3 +- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 0340c933cdd..f1b6f0baeb1 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -415,73 +415,72 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): row.label() def OCEAN(self, layout, ob, md): - col = layout.column() - if not md.build_enabled: col.label("Built without OceanSim modifier") return - col.prop(md, "geometry_mode") + layout.prop(md, "geometry_mode") if md.geometry_mode == 'GENERATE': - row = col.row() + row = layout.row() row.prop(md, "repeat_x") row.prop(md, "repeat_y") - col.separator() + layout.separator() - col.prop(md, "time") - col.prop(md, "resolution") - colflow = col.column_flow() - colflow.prop(md, "spatial_size") - colflow.prop(md, "depth") + flow = layout.column_flow() + flow.prop(md, "time") + flow.prop(md, "resolution") + flow.prop(md, "spatial_size") + flow.prop(md, "depth") + + layout.label("Waves:") + split = layout.split() - col.label("Waves:") + col = split.column() col.prop(md, "choppiness") col.prop(md, "wave_scale", text="Scale") - - col.prop(md, "wave_alignment", text="Alignment") - row = col.row() - row.active = md.wave_alignment > 0 - row.prop(md, "wave_direction", text="Direction") - row.prop(md, "damp") - col.prop(md, "smallest_wave") col.prop(md, "wind_velocity") - - col = layout.column() - col.separator() - - col.prop(md, "generate_normals") - - split = col.split() - split.column().prop(md, "generate_foam") - col = split.column() - col.active = md.generate_foam - col.prop(md, "foam_coverage", text="Coverage") + col.prop(md, "wave_alignment", text="Alignment") + sub = col.column() + sub.active = md.wave_alignment > 0 + sub.prop(md, "wave_direction", text="Direction") + sub.prop(md, "damp") + + layout.separator() + layout.prop(md, "generate_normals") - col = layout.column() - col.separator() + row = layout.row() + row.prop(md, "generate_foam") + sub = row.row() + sub.active = md.generate_foam + sub.prop(md, "foam_coverage", text="Coverage") + layout.separator() + if md.is_cached: - col.operator("object.ocean_bake", text="Free Bake").free=True + layout.operator("object.ocean_bake", text="Free Bake").free=True else: - col.operator("object.ocean_bake") - row = col.row() - row.enabled = not md.is_cached - row.prop(md, "bake_start", text="Start") - row.prop(md, "bake_end", text="End") - col.prop(md, "cachepath") + layout.operator("object.ocean_bake") + + split = layout.split() + split.enabled = not md.is_cached + + col = split.column(align=True) + col.prop(md, "bake_start", text="Start") + col.prop(md, "bake_end", text="End") + + col = split.column(align=True) + col.label(text="Cache path:") + col.prop(md, "filepath", text="") #col.prop(md, "bake_foam_fade") - - - - + def PARTICLE_INSTANCE(self, layout, ob, md): layout.prop(md, "object") layout.prop(md, "particle_system_index", text="Particle System") diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index aed5ba8840b..b0ad653e86b 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3029,8 +3029,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is useing cached data or simulating"); - - prop= RNA_def_property(srna, "cachepath", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "cachepath"); RNA_def_property_ui_text(prop, "Cache Path", "Path to a folder to store external baked images"); //RNA_def_property_update(prop, 0, "rna_Modifier_update"); From 2414abae0662c3aa80f4910a48b544900ec42930 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 13 Nov 2011 13:04:46 +0000 Subject: [PATCH 011/203] Ocean Modifer: * Reuse the placeholder "eModifierType_EmptySlot" for the new Ocean modifier. WARNING: DO NOT use Ocean modifier in trunk with a revision below this commit! Files won't load then!! --- source/blender/makesdna/DNA_modifier_types.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index aec984cda34..185ef8cbef8 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -73,9 +73,8 @@ typedef enum ModifierType { eModifierType_WeightVGEdit, eModifierType_WeightVGMix, eModifierType_WeightVGProximity, - eModifierType_EmptySlot, /* keep so DynamicPaint keep loading, can re-use later */ - eModifierType_DynamicPaint, /* reserve slot */ eModifierType_Ocean, + eModifierType_DynamicPaint, NUM_MODIFIER_TYPES } ModifierType; From b5a57b193d098fa343cf053167e1faf5078c28c9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 13 Nov 2011 13:08:15 +0000 Subject: [PATCH 012/203] Fix #29041: parenting problem with tree IK for iTaSC and iksolver, where it would use the wrong bone as parent on brancing. Patch by Juha Maki-Kanto. --- intern/itasc/kdl/chain.hpp | 1 + .../blender/ikplugin/intern/iksolver_plugin.c | 24 +++++++++++++++---- .../blender/ikplugin/intern/itasc_plugin.cpp | 10 +++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/intern/itasc/kdl/chain.hpp b/intern/itasc/kdl/chain.hpp index a2b4905622e..81c606b73c0 100644 --- a/intern/itasc/kdl/chain.hpp +++ b/intern/itasc/kdl/chain.hpp @@ -24,6 +24,7 @@ #include "segment.hpp" #include +#include namespace KDL { /** diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 7159c09d703..eb3695ea217 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -62,8 +62,8 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t PoseTarget *target; bConstraint *con; bKinematicConstraint *data; - int a, segcount= 0, size, newsize, *oldparent, parent; - + int a, t, segcount= 0, size, newsize, *oldparent, parent; + /* find IK constraint, and validate it */ for(con= pchan_tip->constraints.first; con; con= con->next) { if(con->type==CONSTRAINT_TYPE_KINEMATIC) { @@ -114,7 +114,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t if(tree==NULL) { /* make new tree */ tree= MEM_callocN(sizeof(PoseTree), "posetree"); - + tree->type= CONSTRAINT_TYPE_KINEMATIC; tree->iterations= data->iterations; @@ -138,13 +138,27 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t /* skip common pose channels and add remaining*/ size= MIN2(segcount, tree->totchannel); - for(a=0; apchan[a]==chanlist[segcount-a-1]; a++); - parent= a-1; + a = t = 0; + while (atotchannel) { + // locate first matching channel + for (;ttotchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++); + if (t>=tree->totchannel) + break; + for(; atotchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); + } segcount= segcount-a; target->tip= tree->totchannel + segcount - 1; if (segcount > 0) { + for(parent = a - 1; parent < tree->totchannel; parent++) + if(tree->pchan[parent] == chanlist[segcount-1]->parent) + break; + + /* shouldn't happen, but could with dependency cycles */ + if(parent == tree->totchannel) + parent = a - 1; + /* resize array */ newsize= tree->totchannel + segcount; oldchan= tree->pchan; diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 2cb3a32ae3e..f4720b7fc41 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -326,11 +326,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co break; for(; atotchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); } - parent= a-1; + segcount= segcount-a; target->tip= tree->totchannel + segcount - 1; if (segcount > 0) { + for(parent = a - 1; parent < tree->totchannel; parent++) + if(tree->pchan[parent] == chanlist[segcount-1]->parent) + break; + + /* shouldn't happen, but could with dependency cycles */ + if(parent == tree->totchannel) + parent = a - 1; + /* resize array */ newsize= tree->totchannel + segcount; oldchan= tree->pchan; From 393c7b2e93244f85e05fcb65e6d3540158c75aad Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sun, 13 Nov 2011 13:25:22 +0000 Subject: [PATCH 013/203] OSX: go back to former zoombehaviour with magicmouse in Lion, no time to recode to NSTouch in the near time --- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 730a7c08151..03c3427045d 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -578,7 +578,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa() if (strstr(rstring,"MacBookAir") || (strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9'))) m_hasMultiTouchTrackpad = true; - else m_hasMultiTouchTrackpad = true; // experimental, changes only MagicMouse behaviour (zoom->pan) but enables MagicTrackpad for all Macs + else m_hasMultiTouchTrackpad = false; free( rstring ); rstring = NULL; From d4d95ea1c1b53364e37827a7e65086d6e8cc2e20 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 13:52:15 +0000 Subject: [PATCH 014/203] fix for buffer overrun when grease pencil drawing in the clip editor. --- source/blender/editors/gpencil/gpencil_paint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index bd02df2ddba..2dd8ef4da94 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -105,9 +105,9 @@ typedef struct tGPsdata { short flags; /* flags that can get set during runtime */ float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space - to region space */ + * to region space */ - float custom_color[3]; /* custom color for */ + float custom_color[4]; /* custom color for (?) */ } tGPsdata; /* values for tGPsdata->status */ From 46a673c2957dade00da91381a56ed9352fe9b923 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 13:56:40 +0000 Subject: [PATCH 015/203] fix another buffer overrun error, also replace BLI_snprintf with BLI_strncpy since no formatting is needed in this case. --- source/blender/blenkernel/intern/dynamicpaint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 40421c25607..ebbe57a6f81 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -207,7 +207,7 @@ typedef struct PaintAdjData { static int setError(DynamicPaintCanvasSettings *canvas, const char *string) { /* Add error to canvas ui info label */ - BLI_snprintf(canvas->error, sizeof(canvas->error), string); + BLI_strncpy(canvas->error, string, sizeof(canvas->error)); return 0; } @@ -1919,7 +1919,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh /* Get closest edge to that subpixel on UV map */ { float pixel[2], dist, t_dist; - int i, uindex[2], edge1_index, edge2_index, + int i, uindex[3], edge1_index, edge2_index, e1_index, e2_index, target_face; float closest_point[2], lambda, dir_vec[2]; int target_uv1, target_uv2, final_pixel[2], final_index; From 7edd4f93f162ea86730b65fda6a6b858f7121c34 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 14:11:02 +0000 Subject: [PATCH 016/203] add missing break in ocean_texture switch statement & quiet some warnings. --- source/blender/blenloader/intern/readfile.c | 4 +- .../render/intern/source/texture_ocean.c | 62 +++++++++---------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9e3feedc5d9..53df4bbecfa 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11861,9 +11861,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) { Object *ob; - Tex *tex; - - + /* ocean res is now squared, reset old ones - will be massive */ for(ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; diff --git a/source/blender/render/intern/source/texture_ocean.c b/source/blender/render/intern/source/texture_ocean.c index c9d84b23e33..95985eb7f2b 100644 --- a/source/blender/render/intern/source/texture_ocean.c +++ b/source/blender/render/intern/source/texture_ocean.c @@ -57,13 +57,12 @@ extern struct Render R; int ocean_texture(Tex *tex, float *texvec, TexResult *texres) { int retval = TEX_INT; - OceanTex *ot= tex->ot; - OceanResult or; - const float u = 0.5+0.5*texvec[0]; - const float v = 0.5+0.5*texvec[1]; - float foam; + OceanTex *ot= tex->ot; + OceanResult ocr; + const float u = 0.5f+0.5f*texvec[0]; + const float v = 0.5f+0.5f*texvec[1]; int cfra = R.r.cfra; - int normals=0; + int normals= 0; ModifierData *md; texres->tin = 0.0f; @@ -84,16 +83,16 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) CLAMP(cfra, omd->bakestart, omd->bakeend); cfra -= omd->bakestart; // shift to 0 based - BKE_ocean_cache_eval_uv(omd->oceancache, &or, cfra, u, v); + BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); } else { // non-cached if (G.rendering) - BKE_ocean_eval_uv_catrom(omd->ocean, &or, u, v); + BKE_ocean_eval_uv_catrom(omd->ocean, &ocr, u, v); else - BKE_ocean_eval_uv(omd->ocean, &or, u, v); + BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); - or.foam = BKE_ocean_jminus_to_foam(or.Jminus, omd->foam_coverage); + ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage); } } @@ -101,13 +100,13 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) switch (ot->output) { case TEX_OCN_DISPLACEMENT: /* XYZ displacement */ - texres->tr = 0.5 + 0.5 * or.disp[0]; - texres->tg = 0.5 + 0.5 * or.disp[2]; - texres->tb = 0.5 + 0.5 * or.disp[1]; + texres->tr = 0.5f + 0.5f * ocr.disp[0]; + texres->tg = 0.5f + 0.5f * ocr.disp[2]; + texres->tb = 0.5f + 0.5f * ocr.disp[1]; - texres->tr = MAX2(0.0, texres->tr); - texres->tg = MAX2(0.0, texres->tg); - texres->tb = MAX2(0.0, texres->tb); + texres->tr = MAX2(0.0f, texres->tr); + texres->tg = MAX2(0.0f, texres->tg); + texres->tb = MAX2(0.0f, texres->tb); BRICONTRGB; @@ -116,46 +115,43 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) case TEX_OCN_EMINUS: /* -ve eigenvectors ? */ - texres->tr = or.Eminus[0]; - texres->tg = or.Eminus[2]; - texres->tb = or.Eminus[1]; + texres->tr = ocr.Eminus[0]; + texres->tg = ocr.Eminus[2]; + texres->tb = ocr.Eminus[1]; retval = TEX_RGB; break; case TEX_OCN_EPLUS: /* -ve eigenvectors ? */ - texres->tr = or.Eplus[0]; - texres->tg = or.Eplus[2]; - texres->tb = or.Eplus[1]; + texres->tr = ocr.Eplus[0]; + texres->tg = ocr.Eplus[2]; + texres->tb = ocr.Eplus[1]; retval = TEX_RGB; break; case TEX_OCN_JPLUS: - texres->tin = or.Jplus; + texres->tin = ocr.Jplus; retval = TEX_INT; + break; + case TEX_OCN_FOAM: - texres->tin = or.foam; + texres->tin = ocr.foam; - BRICONT; + BRICONT; retval = TEX_INT; break; } - + /* if normals needed */ if (texres->nor && normals) { - - texres->nor[0] = or.normal[0]; - texres->nor[1] = or.normal[2]; - texres->nor[2] = or.normal[1]; - - normalize_v3(texres->nor); + normalize_v3_v3(texres->nor, ocr.normal); retval |= TEX_NOR; } - texres->ta = 1.0; + texres->ta = 1.0f; return retval; } From 7d0b5920c6d5d2bd889eab55679adaf39d146028 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 14:16:43 +0000 Subject: [PATCH 017/203] rename cmake WITH_OCEANSIM --> WITH_MOD_OCEANSIM and tag CYCLES_CUDA_BINARIES_ARCH as advanced. --- CMakeLists.txt | 9 +++++---- build_files/cmake/config/blender_lite.cmake | 1 + source/blender/blenkernel/CMakeLists.txt | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 2 +- source/blender/modifiers/CMakeLists.txt | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40239a16f02..6f8e72f7494 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ option(WITH_MOD_DECIMATE "Enable Decimate Modifier" ON) option(WITH_MOD_BOOLEAN "Enable Boolean Modifier" ON) option(WITH_MOD_CLOTH_ELTOPO "Enable Experemental cloth solver" OFF) mark_as_advanced(WITH_MOD_CLOTH_ELTOPO) -option(WITH_OCEANSIM "Enable Ocean Modifier" OFF) +option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF) # Image format support option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON) @@ -219,6 +219,7 @@ option(WITH_CYCLES "Enable cycles Render Engine" ON) option(WITH_CYCLES_TEST "Build cycles test application" OFF) option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF) set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for") +mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) # disable for now, but plan to support on all platforms eventually option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF) @@ -286,8 +287,8 @@ if(WITH_CODEC_QUICKTIME AND MINGW) "line if youre a developer who wants to add support.") endif() -if(NOT WITH_FFTW3 AND WITH_OCEANSIM) - message(FATAL_ERROR "WITH_OCEANSIM requires WITH_FFTW3 to be ON") +if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM) + message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON") endif() # may as well build python module without a UI @@ -1567,7 +1568,7 @@ if(FIRST_RUN) info_cfg_option(WITH_MOD_BOOLEAN) info_cfg_option(WITH_MOD_DECIMATE) info_cfg_option(WITH_MOD_FLUID) - info_cfg_option(WITH_OCEANSIM) + info_cfg_option(WITH_MOD_OCEANSIM) info_cfg_text("") diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake index 4f04960d5e3..26fa7623f21 100644 --- a/build_files/cmake/config/blender_lite.cmake +++ b/build_files/cmake/config/blender_lite.cmake @@ -34,6 +34,7 @@ set(WITH_MOD_BOOLEAN OFF CACHE FORCE BOOL) set(WITH_MOD_DECIMATE OFF CACHE FORCE BOOL) set(WITH_MOD_FLUID OFF CACHE FORCE BOOL) set(WITH_MOD_SMOKE OFF CACHE FORCE BOOL) +set(WITH_MOD_OCEANSIM OFF CACHE FORCE BOOL) set(WITH_AUDASPACE OFF CACHE FORCE BOOL) set(WITH_OPENAL OFF CACHE FORCE BOOL) set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 4e7561a1bc8..fd98da949ca 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -343,7 +343,7 @@ if(WITH_MOD_SMOKE) add_definitions(-DWITH_SMOKE) endif() -if(WITH_OCEANSIM) +if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index e50617f220c..fd9cd26cbfa 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -206,7 +206,7 @@ if(WITH_FFTW3) add_definitions(-DWITH_FFTW3) endif() -if(WITH_OCEANSIM) +if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 4aedb4ae7a8..87498b3bb63 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -117,7 +117,7 @@ if(WITH_MOD_FLUID) add_definitions(-DWITH_MOD_FLUID) endif() -if(WITH_OCEANSIM) +if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() From 64ca81ef0f34552c07301871c0de18933e3da8c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 14:29:17 +0000 Subject: [PATCH 018/203] allow passing vars to cmake from our makefile --- GNUmakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 640e90de74b..2ac3439d6aa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -34,7 +34,10 @@ OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]') # Source and Build DIR's BLENDER_DIR:=$(shell pwd -P) BUILD_TYPE:=Release -BUILD_CMAKE_ARGS:= + +ifndef BUILD_CMAKE_ARGS + BUILD_CMAKE_ARGS:= +endif ifndef BUILD_DIR BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE) @@ -123,6 +126,7 @@ help: @echo " * bpy - build as a python module which can be loaded from python directly" @echo "" @echo " Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir." + @echo " Note, passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments." @echo "" @echo "" @echo "Project Files for IDE's" From a7c37e525481d17d06e3a9993b1c765c7385d2cb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 14:38:00 +0000 Subject: [PATCH 019/203] pep8 edits --- .../startup/bl_ui/properties_data_modifier.py | 26 +++++++++---------- .../startup/bl_ui/properties_texture.py | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index f1b6f0baeb1..17faf5b6627 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -420,14 +420,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): return layout.prop(md, "geometry_mode") - + if md.geometry_mode == 'GENERATE': row = layout.row() row.prop(md, "repeat_x") row.prop(md, "repeat_y") layout.separator() - + flow = layout.column_flow() flow.prop(md, "time") flow.prop(md, "resolution") @@ -435,15 +435,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): flow.prop(md, "depth") layout.label("Waves:") - + split = layout.split() - + col = split.column() col.prop(md, "choppiness") col.prop(md, "wave_scale", text="Scale") col.prop(md, "smallest_wave") col.prop(md, "wind_velocity") - + col = split.column() col.prop(md, "wave_alignment", text="Alignment") sub = col.column() @@ -452,33 +452,33 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): sub.prop(md, "damp") layout.separator() - + layout.prop(md, "generate_normals") - + row = layout.row() row.prop(md, "generate_foam") sub = row.row() sub.active = md.generate_foam sub.prop(md, "foam_coverage", text="Coverage") - + layout.separator() if md.is_cached: - layout.operator("object.ocean_bake", text="Free Bake").free=True + layout.operator("object.ocean_bake", text="Free Bake").free = True else: layout.operator("object.ocean_bake") - + split = layout.split() split.enabled = not md.is_cached - + col = split.column(align=True) col.prop(md, "bake_start", text="Start") col.prop(md, "bake_end", text="End") - + col = split.column(align=True) col.label(text="Cache path:") col.prop(md, "filepath", text="") - + #col.prop(md, "bake_foam_fade") def PARTICLE_INSTANCE(self, layout, ob, md): diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 70c231b11bf..6b4cfa8fb95 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -778,14 +778,14 @@ class TEXTURE_PT_ocean(TextureTypePanel, Panel): bl_label = "Ocean" tex_type = 'OCEAN' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - + def draw(self, context): layout = self.layout - + tex = context.texture ot = tex.ocean - - col = layout.column() + + col = layout.column() col.prop(ot, "ocean_object") col.prop(ot, "output") From cbef65dedaf7afb3ec8cb00fd7ab4b206cc02c45 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Sun, 13 Nov 2011 14:39:10 +0000 Subject: [PATCH 020/203] Stub data in Ocean modifier when disabled, C standard does not allow empty structs. --- source/blender/blenkernel/intern/ocean.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 455acd2130f..24d7701dcfc 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1314,6 +1314,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v /* stub */ typedef struct Ocean { + /* need some data here, C does not allow empty struct */ + int stub; } Ocean; From 2e32ce0ed2654c2ca582c0903329740ebece28d4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 14:50:19 +0000 Subject: [PATCH 021/203] add the ocean modifier to bpath visitor --- source/blender/blenlib/intern/bpath.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 8ad79dd819a..ce5927cf3cc 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -431,6 +431,10 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla ClothModifierData *clmd= (ClothModifierData*) md; BPATH_TRAVERSE_POINTCACHE(clmd->ptcaches); } + else if (md->type==eModifierType_Ocean) { + OceanModifierData *omd= (OceanModifierData*) md; + rewrite_path_fixed(omd->cachepath, visit_cb, absbase, bpath_user_data); + } } if (ob->soft) { From 00b695a6f3d663a191985089ee076aee8c8152dd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 13 Nov 2011 14:54:11 +0000 Subject: [PATCH 022/203] Ocean Sim: sort alphabetically in modifier list, fix python error trying to show "Built without OceanSim modifier" message. --- release/scripts/startup/bl_ui/properties_data_modifier.py | 2 +- source/blender/makesrna/intern/rna_modifier.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 17faf5b6627..b30958cbcc2 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -416,7 +416,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): def OCEAN(self, layout, ob, md): if not md.build_enabled: - col.label("Built without OceanSim modifier") + layout.label("Built without OceanSim modifier") return layout.prop(md, "geometry_mode") diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b0ad653e86b..b50f755b6c7 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -88,15 +88,15 @@ EnumPropertyItem modifier_type_items[] ={ {0, "", 0, "Simulate", ""}, {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""}, {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""}, + {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""}, {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""}, {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""}, + {eModifierType_Ocean, "OCEAN", ICON_MOD_WAVE, "Ocean", ""}, {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""}, {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""}, {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""}, {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""}, - {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""}, - {eModifierType_Ocean, "OCEAN", ICON_MOD_WAVE, "Ocean", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME From ea38cb2e5eb84fbc6e15e64c69589c691a5d240a Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sun, 13 Nov 2011 15:10:54 +0000 Subject: [PATCH 023/203] Scons_buildsystem: add WITH_BF_OCEANSIM = True to all configs --- build_files/scons/config/darwin-config.py | 1 + build_files/scons/config/freebsd7-config.py | 1 + build_files/scons/config/freebsd8-config.py | 1 + build_files/scons/config/freebsd9-config.py | 1 + build_files/scons/config/linux-config.py | 1 + build_files/scons/config/linuxcross-config.py | 1 + build_files/scons/config/win32-mingw-config.py | 1 + build_files/scons/config/win32-vc-config.py | 1 + build_files/scons/config/win64-vc-config.py | 1 + 9 files changed, 9 insertions(+) diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 02beb80b5b1..d6da908f074 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -217,6 +217,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index eb7d7c9de57..ed99ac6e094 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -84,6 +84,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = False WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index 451d22455e0..c62b30a7a56 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -84,6 +84,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = False WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index 2ce6ec7ce33..c16795929f2 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -84,6 +84,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = False WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index 655054706f5..3461f4a9af3 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -94,6 +94,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index f6f72cd32d5..5e2c1d67d1f 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -90,6 +90,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = False +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index e224c08d354..87f819db7d1 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -102,6 +102,7 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 0440093b41a..7295a16c4bc 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -96,6 +96,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 8c2956666a9..eb04d9f6403 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -100,6 +100,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True WITH_BF_PLAYER = True +WITH_BF_OCEANSIM = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' From 8b323417751ecc051e445a8e69188cf00afa3c4e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 15:17:24 +0000 Subject: [PATCH 024/203] ensure that the path and directory are joined correctly for ocean cache (assumed path ended with a '/') --- source/blender/blenkernel/CMakeLists.txt | 4 +++- source/blender/blenkernel/intern/ocean.c | 18 ++++++++++-------- source/blender/modifiers/intern/MOD_ocean.c | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index fd98da949ca..b4745669ff0 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -385,7 +385,9 @@ if(WITH_LIBMV) endif() if(WITH_FFTW3) - list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${FFTW3_INCLUDE_DIRS} + ) add_definitions(-DFFTW3=1) endif() diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 24d7701dcfc..e050ff89f86 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -46,6 +46,7 @@ #include "BLI_rand.h" #include "BLI_string.h" #include "BLI_threads.h" +#include "BLI_path_util.h" #include "BLI_utildefines.h" #include "IMB_imbuf.h" @@ -994,26 +995,27 @@ void BKE_free_ocean(struct Ocean *oc) #define CACHE_TYPE_FOAM 2 #define CACHE_TYPE_NORMAL 3 -static void cache_filename(char *string, char *path, int frame, int type) +static void cache_filename(char *string, const char *path, int frame, int type) { - char *cachepath=NULL; + char cachepath[FILE_MAX]; + const char *fname; switch(type) { case CACHE_TYPE_FOAM: - cachepath = BLI_strdupcat(path, "foam_"); + fname= "foam_"; break; case CACHE_TYPE_NORMAL: - cachepath = BLI_strdupcat(path, "normal_"); + fname= "normal_"; break; case CACHE_TYPE_DISPLACE: default: - cachepath = BLI_strdupcat(path, "disp_"); + fname= "disp_"; break; } - + + BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); + BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE); - - MEM_freeN(cachepath); } void BKE_free_ocean_cache(struct OceanCache *och) diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index f36d3674913..2613cf2b944 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -122,9 +122,9 @@ static void initData(ModifierData *md) omd->size = 1.0; omd->repeat_x = 1; omd->repeat_y = 1; - - strcpy(omd->cachepath, "//ocean_cache/"); - + + BLI_strncpy(omd->cachepath, "//ocean_cache", sizeof(omd->cachepath)); + omd->cached = 0; omd->bakestart = 1; omd->bakeend = 250; From 2af9b9476e89b8e9952535b9d7c28d2783cc6ca7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 13 Nov 2011 15:41:40 +0000 Subject: [PATCH 025/203] =?UTF-8?q?Make=20Ocean=20modifier=20compile=20aga?= =?UTF-8?q?in!=20Also=20removed=20it=E2=80=99s=20$ID$=20heading=20stuff.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/modifiers/intern/MOD_ocean.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 2613cf2b944..2c921f2000f 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -1,6 +1,4 @@ /** - * $Id: MOD_ocean.c 28135 2010-04-11 23:20:03Z gsrb3d $ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -43,6 +41,7 @@ #include "BLI_math.h" #include "BLI_math_inline.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "MOD_util.h" From e094ebfcdff19b80d07bdec22c3fea5a841620be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 16:08:01 +0000 Subject: [PATCH 026/203] remove Id:'s from shader node headers --- source/blender/nodes/shader/nodes/node_shader_add_shader.c | 6 ++---- source/blender/nodes/shader/nodes/node_shader_attribute.c | 6 ++---- source/blender/nodes/shader/nodes/node_shader_background.c | 6 ++---- .../nodes/shader/nodes/node_shader_bsdf_anisotropic.c | 6 ++---- .../blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c | 6 ++---- source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c | 4 +--- .../nodes/shader/nodes/node_shader_bsdf_translucent.c | 4 +--- .../nodes/shader/nodes/node_shader_bsdf_transparent.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_emission.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_fresnel.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_geometry.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_holdout.c | 4 +--- .../blender/nodes/shader/nodes/node_shader_layer_weight.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_light_path.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_mix_shader.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_output_lamp.c | 4 +--- .../nodes/shader/nodes/node_shader_output_material.c | 4 +--- .../blender/nodes/shader/nodes/node_shader_output_world.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_coord.c | 4 +--- .../nodes/shader/nodes/node_shader_tex_environment.c | 4 +--- .../blender/nodes/shader/nodes/node_shader_tex_gradient.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_image.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_magic.c | 4 +--- .../blender/nodes/shader/nodes/node_shader_tex_musgrave.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_noise.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_sky.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c | 4 +--- source/blender/nodes/shader/nodes/node_shader_tex_wave.c | 4 +--- .../nodes/shader/nodes/node_shader_volume_isotropic.c | 4 +--- .../nodes/shader/nodes/node_shader_volume_transparent.c | 6 ++---- 32 files changed, 38 insertions(+), 102 deletions(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c index d715971e618..cddf49dd4d5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index 4b238f72117..6fb21f123fb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c index b2bd837d66b..2cdd99da65c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.c +++ b/source/blender/nodes/shader/nodes/node_shader_background.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c index c71696b351c..e19d867a057 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c index 737f77d923e..cf2148bb341 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c index 7d3b91d34d4..2652385e273 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c index 5ccc1cf4a61..03c1ca29de1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c index 2836714f477..74db25f3b13 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c index 5352bd9be30..c74786441f0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c index dfcf3b68d67..7ca38fc0af7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c index 6ef82890559..9b9d95086ce 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.c +++ b/source/blender/nodes/shader/nodes/node_shader_emission.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c index c5d55c9a1c8..b98fa191beb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_fresnel.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c index 63f6ba3928f..2bbdf3c23bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.c +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c index 747519c861e..f08217f3a92 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.c +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c index 16b58e18761..39c7173bd16 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_layer_weight.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c index d399a0bddd4..b64b9bf8b11 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c index 5ce2a03f464..bf44d26024c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c index 2c954d1cf8f..8aa9de15eb4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index 0059489fcc7..58d8bc03972 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c index 20bb3ab8f58..98cecd0d04b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index a33e5599d77..0982c0fe90d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index ecf5a053ad3..5639e82ddb8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index d78a5e9693a..f93507e2997 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index 75b5f26b252..ce614d6117d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index 6c021a7f900..73a66c94193 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 4aefea3e383..00cde10ccea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c index 6c27384a24d..f767fb6f36d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 1abcec86b12..72bcccee5c7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index 6be3a2e928b..563774d8338 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index ed0aa230721..059a41c2b0c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c index 9f4c1447f65..1ce975eae8f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c @@ -1,6 +1,4 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c index 910933bb5fa..5c557aee45d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c @@ -1,12 +1,10 @@ -/** - * $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of From dfd20bb888737555101e934a02d7832a522a11a9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 16:10:01 +0000 Subject: [PATCH 027/203] remove double promotions and some formatting edits (tabs & spaces mixed) --- source/blender/blenkernel/intern/ocean.c | 1507 +++++++++-------- source/blender/modifiers/intern/MOD_ocean.c | 184 +- .../render/intern/source/texture_ocean.c | 45 +- 3 files changed, 868 insertions(+), 868 deletions(-) diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index e050ff89f86..76b5d37bad8 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1,4 +1,4 @@ -/* +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -63,42 +63,42 @@ typedef struct Ocean { /* ********* input parameters to the sim ********* */ - float _V; - float _l; - float _w; - float _A; - float _damp_reflections; - float _wind_alignment; - float _depth; - - float _wx; - float _wz; - - float _L; - - /* dimensions of computational grid */ - int _M; - int _N; - - /* spatial size of computational grid */ - float _Lx; - float _Lz; - - float normalize_factor; // init w - float time; + float _V; + float _l; + float _w; + float _A; + float _damp_reflections; + float _wind_alignment; + float _depth; + + float _wx; + float _wz; + + float _L; + + /* dimensions of computational grid */ + int _M; + int _N; + + /* spatial size of computational grid */ + float _Lx; + float _Lz; + + float normalize_factor; // init w + float time; + + short _do_disp_y; + short _do_normals; + short _do_chop; + short _do_jacobian; - short _do_disp_y; - short _do_normals; - short _do_chop; - short _do_jacobian; - /* mutex for threaded texture access */ ThreadRWMutex oceanmutex; - + /* ********* sim data arrays ********* */ - - /* two dimensional arrays of complex */ - fftw_complex *_fft_in; // init w sim w + + /* two dimensional arrays of complex */ + fftw_complex *_fft_in; // init w sim w fftw_complex *_fft_in_x; // init w sim w fftw_complex *_fft_in_z; // init w sim w fftw_complex *_fft_in_jxx; // init w sim w @@ -106,137 +106,137 @@ typedef struct Ocean { fftw_complex *_fft_in_jxz; // init w sim w fftw_complex *_fft_in_nx; // init w sim w fftw_complex *_fft_in_nz; // init w sim w - fftw_complex *_htilda; // init w sim w (only once) - - /* fftw "plans" */ - fftw_plan _disp_y_plan; // init w sim r - fftw_plan _disp_x_plan; // init w sim r - fftw_plan _disp_z_plan; // init w sim r - fftw_plan _N_x_plan; // init w sim r - fftw_plan _N_z_plan; // init w sim r - fftw_plan _Jxx_plan; // init w sim r - fftw_plan _Jxz_plan; // init w sim r - fftw_plan _Jzz_plan; // init w sim r - - /* two dimensional arrays of float */ - double * _disp_y; // init w sim w via plan? - double * _N_x; // init w sim w via plan? - /*float * _N_y; all member of this array has same values, so convert this array to a float to reduce memory usage (MEM01)*/ - double _N_y; // sim w ********* can be rearranged? - double * _N_z; // init w sim w via plan? - double * _disp_x; // init w sim w via plan? - double * _disp_z; // init w sim w via plan? - - /* two dimensional arrays of float */ - /* Jacobian and minimum eigenvalue */ - double * _Jxx; // init w sim w - double * _Jzz; // init w sim w - double * _Jxz; // init w sim w - - /* one dimensional float array */ - float * _kx; // init w sim r - float * _kz; // init w sim r - - /* two dimensional complex array */ - fftw_complex * _h0; // init w sim r - fftw_complex * _h0_minus; // init w sim r - - /* two dimensional float array */ - float * _k; // init w sim r + fftw_complex *_htilda; // init w sim w (only once) + + /* fftw "plans" */ + fftw_plan _disp_y_plan; // init w sim r + fftw_plan _disp_x_plan; // init w sim r + fftw_plan _disp_z_plan; // init w sim r + fftw_plan _N_x_plan; // init w sim r + fftw_plan _N_z_plan; // init w sim r + fftw_plan _Jxx_plan; // init w sim r + fftw_plan _Jxz_plan; // init w sim r + fftw_plan _Jzz_plan; // init w sim r + + /* two dimensional arrays of float */ + double * _disp_y; // init w sim w via plan? + double * _N_x; // init w sim w via plan? + /*float * _N_y; all member of this array has same values, so convert this array to a float to reduce memory usage (MEM01)*/ + double _N_y; // sim w ********* can be rearranged? + double * _N_z; // init w sim w via plan? + double * _disp_x; // init w sim w via plan? + double * _disp_z; // init w sim w via plan? + + /* two dimensional arrays of float */ + /* Jacobian and minimum eigenvalue */ + double * _Jxx; // init w sim w + double * _Jzz; // init w sim w + double * _Jxz; // init w sim w + + /* one dimensional float array */ + float * _kx; // init w sim r + float * _kz; // init w sim r + + /* two dimensional complex array */ + fftw_complex * _h0; // init w sim r + fftw_complex * _h0_minus; // init w sim r + + /* two dimensional float array */ + float * _k; // init w sim r } Ocean; static float nextfr(float min, float max) { - return BLI_frand()*(min-max)+max; + return BLI_frand()*(min-max)+max; } static float gaussRand (void) { - float x; // Note: to avoid numerical problems with very small - float y; // numbers, we make these variables singe-precision - float length2; // floats, but later we call the double-precision log() + float x; // Note: to avoid numerical problems with very small + float y; // numbers, we make these variables singe-precision + float length2; // floats, but later we call the double-precision log() // and sqrt() functions instead of logf() and sqrtf(). - do - { + do + { x = (float) (nextfr (-1, 1)); y = (float)(nextfr (-1, 1)); length2 = x * x + y * y; - } - while (length2 >= 1 || length2 == 0); - - return x * sqrt (-2 * log (length2) / length2); + } + while (length2 >= 1 || length2 == 0); + + return x * sqrtf(-2.0f * logf(length2) / length2); } /** * Som usefull functions * */ -MINLINE float lerp(float a,float b,float f) +MINLINE float lerp(float a,float b,float f) { - return a + (b-a)*f; + return a + (b-a)*f; } -MINLINE float catrom(float p0,float p1,float p2,float p3,float f) -{ - return 0.5 *((2 * p1) + - (-p0 + p2) * f + - (2*p0 - 5*p1 + 4*p2 - p3) * f*f + - (-p0 + 3*p1- 3*p2 + p3) * f*f*f); +MINLINE float catrom(float p0,float p1,float p2,float p3,float f) +{ + return 0.5f *((2.0f * p1) + + (-p0 + p2) * f + + (2.0f*p0 - 5.0f*p1 + 4.0f*p2 - p3) * f*f + + (-p0 + 3.0f*p1- 3.0f*p2 + p3) * f*f*f); } -MINLINE float omega(float k, float depth) -{ - return sqrt(GRAVITY*k * tanh(k*depth)); +MINLINE float omega(float k, float depth) +{ + return sqrt(GRAVITY*k * tanh(k*depth)); } -// modified Phillips spectrum -static float Ph(struct Ocean* o, float kx,float kz ) +// modified Phillips spectrum +static float Ph(struct Ocean* o, float kx,float kz ) { float tmp; - float k2 = kx*kx + kz*kz; - - if (k2 == 0.0) - { - return 0.0; // no DC component - } - - // damp out the waves going in the direction opposite the wind - tmp = (o->_wx * kx + o->_wz * kz)/sqrt(k2); - if (tmp < 0) - { - tmp *= o->_damp_reflections; - } + float k2 = kx*kx + kz*kz; - return o->_A * exp( -1.0f / (k2*(o->_L*o->_L))) * exp(-k2 * (o->_l*o->_l)) * pow(fabs(tmp),o->_wind_alignment) / (k2*k2); + if (k2 == 0.0f) + { + return 0.0f; // no DC component + } + + // damp out the waves going in the direction opposite the wind + tmp = (o->_wx * kx + o->_wz * kz)/sqrtf(k2); + if (tmp < 0) + { + tmp *= o->_damp_reflections; + } + + return o->_A * expf( -1.0f / (k2*(o->_L*o->_L))) * expf(-k2 * (o->_l*o->_l)) * powf(fabsf(tmp),o->_wind_alignment) / (k2*k2); } static void compute_eigenstuff(struct OceanResult *ocr, float jxx,float jzz,float jxz) { - float a,b,qplus,qminus; - a = jxx + jzz; - b = sqrt((jxx - jzz)*(jxx - jzz) + 4 * jxz * jxz); - - ocr->Jminus = 0.5*(a-b); - ocr->Jplus = 0.5*(a+b); - - qplus = (ocr->Jplus - jxx)/jxz; - qminus = (ocr->Jminus - jxx)/jxz; - - a = sqrt(1 + qplus*qplus); - b = sqrt(1 + qminus*qminus); - - ocr->Eplus[0] = 1.0/ a; - ocr->Eplus[1] = 0.0; - ocr->Eplus[2] = qplus/a; - - ocr->Eminus[0] = 1.0/b; - ocr->Eminus[1] = 0.0; - ocr->Eminus[2] = qminus/b; + float a,b,qplus,qminus; + a = jxx + jzz; + b = sqrt((jxx - jzz)*(jxx - jzz) + 4 * jxz * jxz); + + ocr->Jminus = 0.5f*(a-b); + ocr->Jplus = 0.5f*(a+b); + + qplus = (ocr->Jplus - jxx)/jxz; + qminus = (ocr->Jminus - jxx)/jxz; + + a = sqrt(1 + qplus*qplus); + b = sqrt(1 + qminus*qminus); + + ocr->Eplus[0] = 1.0f/ a; + ocr->Eplus[1] = 0.0f; + ocr->Eplus[2] = qplus/a; + + ocr->Eminus[0] = 1.0f/b; + ocr->Eminus[1] = 0.0f; + ocr->Eminus[2] = qminus/b; } /* - * instead of Complex.h + * instead of Complex.h * in fftw.h "fftw_complex" typedefed as double[2] * below you can see functions are needed to work with such complex numbers. * */ @@ -294,171 +294,172 @@ static void conj_complex(fftw_complex res, fftw_complex cmpl1) static void exp_complex(fftw_complex res, fftw_complex cmpl) { float r = expf(cmpl[0]); - + res[0] = cos(cmpl[1])*r; res[1] = sin(cmpl[1])*r; } -float BKE_ocean_jminus_to_foam(float jminus, float coverage) { - float foam = jminus * -0.005 + coverage; - CLAMP(foam, 0.0, 1.0); +float BKE_ocean_jminus_to_foam(float jminus, float coverage) +{ + float foam = jminus * -0.005f + coverage; + CLAMP(foam, 0.0f, 1.0f); return foam*foam; } void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float v) { - int i0,i1,j0,j1; - float frac_x,frac_z; - float uu,vv; - - // first wrap the texture so 0 <= (u,v) < 1 - u = fmod(u,1.0f); - v = fmod(v,1.0f); - - if (u < 0) u += 1.0f; - if (v < 0) v += 1.0f; - - BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); - + int i0,i1,j0,j1; + float frac_x,frac_z; + float uu,vv; + + // first wrap the texture so 0 <= (u,v) < 1 + u = fmod(u,1.0f); + v = fmod(v,1.0f); + + if (u < 0) u += 1.0f; + if (v < 0) v += 1.0f; + + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); + uu = u * oc->_M; - vv = v * oc->_N; - - i0 = (int)floor(uu); - j0 = (int)floor(vv); - - i1 = (i0 + 1); - j1 = (j0 + 1); - - frac_x = uu - i0; - frac_z = vv - j0; - - i0 = i0 % oc->_M; - j0 = j0 % oc->_N; - - i1 = i1 % oc->_M; - j1 = j1 % oc->_N; - - + vv = v * oc->_N; + + i0 = (int)floor(uu); + j0 = (int)floor(vv); + + i1 = (i0 + 1); + j1 = (j0 + 1); + + frac_x = uu - i0; + frac_z = vv - j0; + + i0 = i0 % oc->_M; + j0 = j0 % oc->_N; + + i1 = i1 % oc->_M; + j1 = j1 % oc->_N; + + #define BILERP(m) (lerp(lerp(m[i0*oc->_N+j0],m[i1*oc->_N+j0],frac_x),lerp(m[i0*oc->_N+j1],m[i1*oc->_N+j1],frac_x),frac_z)) - { - if (oc->_do_disp_y) { - ocr->disp[1] = BILERP(oc->_disp_y); - } - - if (oc->_do_normals) { - ocr->normal[0] = BILERP(oc->_N_x); - ocr->normal[1] = oc->_N_y/*BILERP(oc->_N_y) (MEM01)*/; - ocr->normal[2] = BILERP(oc->_N_z); - } - - if (oc->_do_chop) { - ocr->disp[0] = BILERP(oc->_disp_x); - ocr->disp[2] = BILERP(oc->_disp_z); - } else { - ocr->disp[0] = 0.0; - ocr->disp[2] = 0.0; - } - - if (oc->_do_jacobian) { - compute_eigenstuff(ocr, BILERP(oc->_Jxx),BILERP(oc->_Jzz),BILERP(oc->_Jxz)); - } - } + { + if (oc->_do_disp_y) { + ocr->disp[1] = BILERP(oc->_disp_y); + } + + if (oc->_do_normals) { + ocr->normal[0] = BILERP(oc->_N_x); + ocr->normal[1] = oc->_N_y/*BILERP(oc->_N_y) (MEM01)*/; + ocr->normal[2] = BILERP(oc->_N_z); + } + + if (oc->_do_chop) { + ocr->disp[0] = BILERP(oc->_disp_x); + ocr->disp[2] = BILERP(oc->_disp_z); + } else { + ocr->disp[0] = 0.0; + ocr->disp[2] = 0.0; + } + + if (oc->_do_jacobian) { + compute_eigenstuff(ocr, BILERP(oc->_Jxx),BILERP(oc->_Jzz),BILERP(oc->_Jxz)); + } + } #undef BILERP - + BLI_rw_mutex_unlock(&oc->oceanmutex); } // use catmullrom interpolation rather than linear void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u,float v) { - int i0,i1,i2,i3,j0,j1,j2,j3; - float frac_x,frac_z; - float uu,vv; - - // first wrap the texture so 0 <= (u,v) < 1 - u = fmod(u,1.0f); - v = fmod(v,1.0f); - - if (u < 0) u += 1.0f; - if (v < 0) v += 1.0f; - + int i0,i1,i2,i3,j0,j1,j2,j3; + float frac_x,frac_z; + float uu,vv; + + // first wrap the texture so 0 <= (u,v) < 1 + u = fmod(u,1.0f); + v = fmod(v,1.0f); + + if (u < 0) u += 1.0f; + if (v < 0) v += 1.0f; + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); - - uu = u * oc->_M; - vv = v * oc->_N; - - i1 = (int)floor(uu); - j1 = (int)floor(vv); - - i2 = (i1 + 1); - j2 = (j1 + 1); - - frac_x = uu - i1; - frac_z = vv - j1; - - i1 = i1 % oc->_M; - j1 = j1 % oc->_N; - - i2 = i2 % oc->_M; - j2 = j2 % oc->_N; - - i0 = (i1-1); - i3 = (i2+1); - i0 = i0 < 0 ? i0 + oc->_M : i0; - i3 = i3 >= oc->_M ? i3 - oc->_M : i3; - - j0 = (j1-1); - j3 = (j2+1); - j0 = j0 < 0 ? j0 + oc->_N : j0; - j3 = j3 >= oc->_N ? j3 - oc->_N : j3; - + + uu = u * oc->_M; + vv = v * oc->_N; + + i1 = (int)floor(uu); + j1 = (int)floor(vv); + + i2 = (i1 + 1); + j2 = (j1 + 1); + + frac_x = uu - i1; + frac_z = vv - j1; + + i1 = i1 % oc->_M; + j1 = j1 % oc->_N; + + i2 = i2 % oc->_M; + j2 = j2 % oc->_N; + + i0 = (i1-1); + i3 = (i2+1); + i0 = i0 < 0 ? i0 + oc->_M : i0; + i3 = i3 >= oc->_M ? i3 - oc->_M : i3; + + j0 = (j1-1); + j3 = (j2+1); + j0 = j0 < 0 ? j0 + oc->_N : j0; + j3 = j3 >= oc->_N ? j3 - oc->_N : j3; + #define INTERP(m) catrom(catrom(m[i0*oc->_N+j0],m[i1*oc->_N+j0],m[i2*oc->_N+j0],m[i3*oc->_N+j0],frac_x),\ -catrom(m[i0*oc->_N+j1],m[i1*oc->_N+j1],m[i2*oc->_N+j1],m[i3*oc->_N+j1],frac_x),\ -catrom(m[i0*oc->_N+j2],m[i1*oc->_N+j2],m[i2*oc->_N+j2],m[i3*oc->_N+j2],frac_x),\ -catrom(m[i0*oc->_N+j3],m[i1*oc->_N+j3],m[i2*oc->_N+j3],m[i3*oc->_N+j3],frac_x),\ -frac_z) - - { - if (oc->_do_disp_y) - { - ocr->disp[1] = INTERP(oc->_disp_y) ; - } - if (oc->_do_normals) - { - ocr->normal[0] = INTERP(oc->_N_x); - ocr->normal[1] = oc->_N_y/*INTERP(oc->_N_y) (MEM01)*/; - ocr->normal[2] = INTERP(oc->_N_z); - } - if (oc->_do_chop) - { - ocr->disp[0] = INTERP(oc->_disp_x); - ocr->disp[2] = INTERP(oc->_disp_z); - } - else - { - ocr->disp[0] = 0.0; - ocr->disp[2] = 0.0; - } - - if (oc->_do_jacobian) - { - compute_eigenstuff(ocr, INTERP(oc->_Jxx),INTERP(oc->_Jzz),INTERP(oc->_Jxz)); - } - } + catrom(m[i0*oc->_N+j1],m[i1*oc->_N+j1],m[i2*oc->_N+j1],m[i3*oc->_N+j1],frac_x),\ + catrom(m[i0*oc->_N+j2],m[i1*oc->_N+j2],m[i2*oc->_N+j2],m[i3*oc->_N+j2],frac_x),\ + catrom(m[i0*oc->_N+j3],m[i1*oc->_N+j3],m[i2*oc->_N+j3],m[i3*oc->_N+j3],frac_x),\ + frac_z) + + { + if (oc->_do_disp_y) + { + ocr->disp[1] = INTERP(oc->_disp_y) ; + } + if (oc->_do_normals) + { + ocr->normal[0] = INTERP(oc->_N_x); + ocr->normal[1] = oc->_N_y/*INTERP(oc->_N_y) (MEM01)*/; + ocr->normal[2] = INTERP(oc->_N_z); + } + if (oc->_do_chop) + { + ocr->disp[0] = INTERP(oc->_disp_x); + ocr->disp[2] = INTERP(oc->_disp_z); + } + else + { + ocr->disp[0] = 0.0; + ocr->disp[2] = 0.0; + } + + if (oc->_do_jacobian) + { + compute_eigenstuff(ocr, INTERP(oc->_Jxx),INTERP(oc->_Jzz),INTERP(oc->_Jxz)); + } + } #undef INTERP - + BLI_rw_mutex_unlock(&oc->oceanmutex); - + } void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x,float z) { - BKE_ocean_eval_uv(oc, ocr, x/oc->_Lx,z/oc->_Lz); + BKE_ocean_eval_uv(oc, ocr, x/oc->_Lx,z/oc->_Lz); } void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x,float z) { - BKE_ocean_eval_uv_catrom(oc, ocr, x/oc->_Lx,z/oc->_Lz); + BKE_ocean_eval_uv_catrom(oc, ocr, x/oc->_Lx,z/oc->_Lz); } // note that this doesn't wrap properly for i,j < 0, but its @@ -467,310 +468,310 @@ void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j) { BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); - - i = abs(i) % oc->_M; - j = abs(j) % oc->_N; - - ocr->disp[1] = oc->_do_disp_y ? oc->_disp_y[i*oc->_N+j] : 0.0f; - - if (oc->_do_chop) - { - ocr->disp[0] = oc->_disp_x[i*oc->_N+j]; - ocr->disp[2] = oc->_disp_z[i*oc->_N+j]; - } - else - { - ocr->disp[0] = 0.0f; - ocr->disp[2] = 0.0f; - } - - if (oc->_do_normals) - { - ocr->normal[0] = oc->_N_x[i*oc->_N+j]; - ocr->normal[1] = oc->_N_y/*oc->_N_y[i*oc->_N+j] (MEM01)*/; - ocr->normal[2] = oc->_N_z[i*oc->_N+j]; - } - - if (oc->_do_jacobian) - { + + i = abs(i) % oc->_M; + j = abs(j) % oc->_N; + + ocr->disp[1] = oc->_do_disp_y ? oc->_disp_y[i*oc->_N+j] : 0.0f; + + if (oc->_do_chop) + { + ocr->disp[0] = oc->_disp_x[i*oc->_N+j]; + ocr->disp[2] = oc->_disp_z[i*oc->_N+j]; + } + else + { + ocr->disp[0] = 0.0f; + ocr->disp[2] = 0.0f; + } + + if (oc->_do_normals) + { + ocr->normal[0] = oc->_N_x[i*oc->_N+j]; + ocr->normal[1] = oc->_N_y/*oc->_N_y[i*oc->_N+j] (MEM01)*/; + ocr->normal[2] = oc->_N_z[i*oc->_N+j]; + } + + if (oc->_do_jacobian) + { compute_eigenstuff(ocr, oc->_Jxx[i*oc->_N+j],oc->_Jzz[i*oc->_N+j],oc->_Jxz[i*oc->_N+j]); - } - + } + BLI_rw_mutex_unlock(&oc->oceanmutex); } void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount) { int i, j; - + scale *= o->normalize_factor; - + BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE); - + // compute a new htilda - #pragma omp parallel for private(i, j) - for (i = 0 ; i < o->_M ; ++i) - { - // note the <= _N/2 here, see the fftw doco about - // the mechanics of the complex->real fft storage - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex exp_param1; - fftw_complex exp_param2; - fftw_complex conj_param; - - - init_complex(exp_param1, 0.0, omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); - init_complex(exp_param2, 0.0, -omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); - exp_complex(exp_param1, exp_param1); - exp_complex(exp_param2, exp_param2); - conj_complex(conj_param, o->_h0_minus[i*o->_N+j]); - - mul_complex_c(exp_param1, o->_h0[i*o->_N+j], exp_param1); - mul_complex_c(exp_param2, conj_param, exp_param2); - - add_comlex_c(o->_htilda[i*(1+o->_N/2)+j], exp_param1, exp_param2); - mul_complex_f(o->_fft_in[i*(1+o->_N/2)+j], o->_htilda[i*(1+o->_N/2)+j], scale); - } - } - - #pragma omp parallel sections private(i, j) +#pragma omp parallel for private(i, j) + for (i = 0 ; i < o->_M ; ++i) { - - #pragma omp section - { - if (o->_do_disp_y) + // note the <= _N/2 here, see the fftw doco about + // the mechanics of the complex->real fft storage + for ( j = 0 ; j <= o->_N / 2 ; ++j) { - // y displacement - fftw_execute(o->_disp_y_plan); - } - } // section 1 - - #pragma omp section - { - if (o->_do_chop) - { - // x displacement - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - fftw_complex minus_i; - - init_complex(minus_i, 0.0, -1.0); - init_complex(mul_param, -scale, 0); - mul_complex_f(mul_param, mul_param, chop_amount); - mul_complex_c(mul_param, mul_param, minus_i); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); - init_complex(o->_fft_in_x[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); - } - } - fftw_execute(o->_disp_x_plan); - } - } //section 2 - - #pragma omp section - { - if (o->_do_chop) - { - // z displacement - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - fftw_complex minus_i; - - init_complex(minus_i, 0.0, -1.0); - init_complex(mul_param, -scale, 0); - mul_complex_f(mul_param, mul_param, chop_amount); - mul_complex_c(mul_param, mul_param, minus_i); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); - init_complex(o->_fft_in_z[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); - } - } - fftw_execute(o->_disp_z_plan); - } - } // section 3 + fftw_complex exp_param1; + fftw_complex exp_param2; + fftw_complex conj_param; - #pragma omp section - { - if (o->_do_jacobian) - { - // Jxx - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - - //init_complex(mul_param, -scale, 0); - init_complex(mul_param, -1, 0); - - mul_complex_f(mul_param, mul_param, chop_amount); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i]*o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); - init_complex(o->_fft_in_jxx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); - } - } - fftw_execute(o->_Jxx_plan); - - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j < o->_N ; ++j) - { - o->_Jxx[i*o->_N+j] += 1.0; - } - } - } - } // section 4 - - #pragma omp section - { - if (o->_do_jacobian) - { - // Jzz - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - - //init_complex(mul_param, -scale, 0); - init_complex(mul_param, -1, 0); - - mul_complex_f(mul_param, mul_param, chop_amount); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); - init_complex(o->_fft_in_jzz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); - } - } - fftw_execute(o->_Jzz_plan); - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j < o->_N ; ++j) - { - o->_Jzz[i*o->_N+j] += 1.0; - } - } - } - } // section 5 - - #pragma omp section - { - if (o->_do_jacobian) - { - // Jxz - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - - //init_complex(mul_param, -scale, 0); - init_complex(mul_param, -1, 0); - mul_complex_f(mul_param, mul_param, chop_amount); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); - init_complex(o->_fft_in_jxz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); - } - } - fftw_execute(o->_Jxz_plan); + init_complex(exp_param1, 0.0, omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); + init_complex(exp_param2, 0.0, -omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t); + exp_complex(exp_param1, exp_param1); + exp_complex(exp_param2, exp_param2); + conj_complex(conj_param, o->_h0_minus[i*o->_N+j]); + + mul_complex_c(exp_param1, o->_h0[i*o->_N+j], exp_param1); + mul_complex_c(exp_param2, conj_param, exp_param2); + + add_comlex_c(o->_htilda[i*(1+o->_N/2)+j], exp_param1, exp_param2); + mul_complex_f(o->_fft_in[i*(1+o->_N/2)+j], o->_htilda[i*(1+o->_N/2)+j], scale); } - } // section 6 - - #pragma omp section + } + +#pragma omp parallel sections private(i, j) { - // fft normals - if (o->_do_normals) + +#pragma omp section { - for ( i = 0 ; i < o->_M ; ++i) + if (o->_do_disp_y) { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - - init_complex(mul_param, 0.0, -1.0); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, o->_kx[i]); - init_complex(o->_fft_in_nx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + // y displacement + fftw_execute(o->_disp_y_plan); + } + } // section 1 + +#pragma omp section + { + if (o->_do_chop) + { + // x displacement + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + fftw_complex minus_i; + + init_complex(minus_i, 0.0, -1.0); + init_complex(mul_param, -scale, 0); + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, minus_i); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_x[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_disp_x_plan); + } + } //section 2 + +#pragma omp section + { + if (o->_do_chop) + { + // z displacement + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + fftw_complex minus_i; + + init_complex(minus_i, 0.0, -1.0); + init_complex(mul_param, -scale, 0); + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, minus_i); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_z[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_disp_z_plan); + } + } // section 3 + +#pragma omp section + { + if (o->_do_jacobian) + { + // Jxx + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kx[i]*o->_kx[i] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jxx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_Jxx_plan); + + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j < o->_N ; ++j) + { + o->_Jxx[i*o->_N+j] += 1.0; + } } } - fftw_execute(o->_N_x_plan); - - } - } // section 7 - - #pragma omp section - { - if (o->_do_normals) - { - for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j <= o->_N / 2 ; ++j) - { - fftw_complex mul_param; - - init_complex(mul_param, 0.0, -1.0); - mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); - mul_complex_f(mul_param, mul_param, o->_kz[i]); - init_complex(o->_fft_in_nz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } // section 4 + +#pragma omp section + { + if (o->_do_jacobian) + { + // Jzz + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0 ? 0.0 : o->_kz[j]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jzz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } } - } - fftw_execute(o->_N_z_plan); - + fftw_execute(o->_Jzz_plan); + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j < o->_N ; ++j) + { + o->_Jzz[i*o->_N+j] += 1.0; + } + } + } + } // section 5 + +#pragma omp section + { + if (o->_do_jacobian) + { + // Jxz + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + //init_complex(mul_param, -scale, 0); + init_complex(mul_param, -1, 0); + + mul_complex_f(mul_param, mul_param, chop_amount); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, (o->_k[i*(1+o->_N/2)+j] == 0.0f ? 0.0f : o->_kx[i]*o->_kz[j] / o->_k[i*(1+o->_N/2)+j])); + init_complex(o->_fft_in_jxz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_Jxz_plan); + } + } // section 6 + +#pragma omp section + { + // fft normals + if (o->_do_normals) + { + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + init_complex(mul_param, 0.0, -1.0); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, o->_kx[i]); + init_complex(o->_fft_in_nx[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_N_x_plan); + + } + } // section 7 + +#pragma omp section + { + if (o->_do_normals) + { + for ( i = 0 ; i < o->_M ; ++i) + { + for ( j = 0 ; j <= o->_N / 2 ; ++j) + { + fftw_complex mul_param; + + init_complex(mul_param, 0.0, -1.0); + mul_complex_c(mul_param, mul_param, o->_htilda[i*(1+o->_N/2)+j]); + mul_complex_f(mul_param, mul_param, o->_kz[i]); + init_complex(o->_fft_in_nz[i*(1+o->_N/2)+j], real_c(mul_param), image_c(mul_param)); + } + } + fftw_execute(o->_N_z_plan); + /*for ( i = 0 ; i < o->_M ; ++i) - { - for ( j = 0 ; j < o->_N ; ++j) + { + for ( j = 0 ; j < o->_N ; ++j) { o->_N_y[i*o->_N+j] = 1.0f/scale; } } (MEM01)*/ - o->_N_y = 1.0f/scale; - } - } // section 8 - + o->_N_y = 1.0f/scale; + } + } // section 8 + } // omp sections - + BLI_rw_mutex_unlock(&o->oceanmutex); } -static void set_height_normalize_factor(struct Ocean *oc) -{ - float res = 1.0; - float max_h = 0.0; - +static void set_height_normalize_factor(struct Ocean *oc) +{ + float res = 1.0; + float max_h = 0.0; + int i,j; - + if (!oc->_do_disp_y) return; - + oc->normalize_factor = 1.0; - + BKE_simulate_ocean(oc, 0.0, 1.0, 0); - + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ); - - for (i = 0; i < oc->_M; ++i) - { - for (j = 0; j < oc->_N; ++j) - { - if( max_h < fabsf(oc->_disp_y[i*oc->_N+j])) - { - max_h = fabsf(oc->_disp_y[i*oc->_N+j]); - } - } - } - + + for (i = 0; i < oc->_M; ++i) + { + for (j = 0; j < oc->_N; ++j) + { + if( max_h < fabsf(oc->_disp_y[i*oc->_N+j])) + { + max_h = fabsf(oc->_disp_y[i*oc->_N+j]); + } + } + } + BLI_rw_mutex_unlock(&oc->oceanmutex); - - if (max_h == 0.0) max_h = 0.00001f; // just in case ... - - res = 1.0f / (max_h); + + if (max_h == 0.0f) max_h = 0.00001f; // just in case ... + + res = 1.0f / (max_h); oc->normalize_factor = res; } @@ -780,151 +781,151 @@ struct Ocean *BKE_add_ocean(void) Ocean *oc = MEM_callocN(sizeof(Ocean), "ocean sim data"); BLI_rw_mutex_init(&oc->oceanmutex); - + return oc; } -void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp, - float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed) +void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp, + float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed) { int i,j,ii; - + BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE); - + o->_M = M; - o->_N = N; - o->_V = V; - o->_l = l; - o->_A = A; - o->_w = w; - o->_damp_reflections = 1.0 - damp; - o->_wind_alignment = alignment; - o->_depth = depth; - o->_Lx = Lx; - o->_Lz = Lz; - o->_wx = cos(w); - o->_wz = -sin(w); // wave direction - o->_L = V*V / GRAVITY; // largest wave for a given velocity V - o->time = time; - - o->_do_disp_y = do_height_field; - o->_do_normals = do_normals; - o->_do_chop = do_chop; - o->_do_jacobian = do_jacobian; - - o->_k = (float*) MEM_mallocN(M * (1+N/2) * sizeof(float), "ocean_k"); - o->_h0 = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0"); - o->_h0_minus = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0_minus"); - o->_kx = (float*) MEM_mallocN(o->_M * sizeof(float), "ocean_kx"); - o->_kz = (float*) MEM_mallocN(o->_N * sizeof(float), "ocean_kz"); - - // make this robust in the face of erroneous usage - if (o->_Lx == 0.0) - o->_Lx = 0.001; - - if (o->_Lz == 0.0) - o->_Lz = 0.001; - - // the +ve components and DC - for (i = 0 ; i <= o->_M/2 ; ++i) - o->_kx[i] = 2.0f * M_PI * i / o->_Lx; - - // the -ve components - for (i = o->_M-1,ii=0 ; i > o->_M/2 ; --i,++ii) - o->_kx[i] = -2.0f * M_PI * ii / o->_Lx; - - // the +ve components and DC - for (i = 0 ; i <= o->_N/2 ; ++i) - o->_kz[i] = 2.0f * M_PI * i / o->_Lz; - - // the -ve components - for (i = o->_N-1,ii=0 ; i > o->_N/2 ; --i,++ii) - o->_kz[i] = -2.0f * M_PI * ii / o->_Lz; - - // pre-calculate the k matrix - for (i = 0 ; i < o->_M ; ++i) - for (j = 0 ; j <= o->_N / 2 ; ++j) - o->_k[i*(1+o->_N/2)+j] = sqrt(o->_kx[i]*o->_kx[i] + o->_kz[j]*o->_kz[j] ); - - /*srand(seed);*/ - BLI_srand(seed); - - for (i = 0 ; i < o->_M ; ++i) - { - for (j = 0 ; j < o->_N ; ++j) - { - float r1 = gaussRand(); - float r2 = gaussRand(); - - fftw_complex r1r2; - init_complex(r1r2, r1, r2); - mul_complex_f(o->_h0[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); - mul_complex_f(o->_h0_minus[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i],-o->_kz[j]) / 2.0f))); - } - } - - o->_fft_in = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in"); - o->_htilda = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_htilda"); - - if (o->_do_disp_y){ - o->_disp_y = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y"); - o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE); - } - - if (o->_do_normals){ + o->_N = N; + o->_V = V; + o->_l = l; + o->_A = A; + o->_w = w; + o->_damp_reflections = 1.0f - damp; + o->_wind_alignment = alignment; + o->_depth = depth; + o->_Lx = Lx; + o->_Lz = Lz; + o->_wx = cos(w); + o->_wz = -sin(w); // wave direction + o->_L = V*V / GRAVITY; // largest wave for a given velocity V + o->time = time; + + o->_do_disp_y = do_height_field; + o->_do_normals = do_normals; + o->_do_chop = do_chop; + o->_do_jacobian = do_jacobian; + + o->_k = (float*) MEM_mallocN(M * (1+N/2) * sizeof(float), "ocean_k"); + o->_h0 = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0"); + o->_h0_minus = (fftw_complex*) MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0_minus"); + o->_kx = (float*) MEM_mallocN(o->_M * sizeof(float), "ocean_kx"); + o->_kz = (float*) MEM_mallocN(o->_N * sizeof(float), "ocean_kz"); + + // make this robust in the face of erroneous usage + if (o->_Lx == 0.0f) + o->_Lx = 0.001f; + + if (o->_Lz == 0.0f) + o->_Lz = 0.001f; + + // the +ve components and DC + for (i = 0 ; i <= o->_M/2 ; ++i) + o->_kx[i] = 2.0f * (float)M_PI * i / o->_Lx; + + // the -ve components + for (i = o->_M-1,ii=0 ; i > o->_M/2 ; --i,++ii) + o->_kx[i] = -2.0f * (float)M_PI * ii / o->_Lx; + + // the +ve components and DC + for (i = 0 ; i <= o->_N/2 ; ++i) + o->_kz[i] = 2.0f * (float)M_PI * i / o->_Lz; + + // the -ve components + for (i = o->_N-1,ii=0 ; i > o->_N/2 ; --i,++ii) + o->_kz[i] = -2.0f * (float)M_PI * ii / o->_Lz; + + // pre-calculate the k matrix + for (i = 0 ; i < o->_M ; ++i) + for (j = 0 ; j <= o->_N / 2 ; ++j) + o->_k[i*(1+o->_N/2)+j] = sqrt(o->_kx[i]*o->_kx[i] + o->_kz[j]*o->_kz[j] ); + + /*srand(seed);*/ + BLI_srand(seed); + + for (i = 0 ; i < o->_M ; ++i) + { + for (j = 0 ; j < o->_N ; ++j) + { + float r1 = gaussRand(); + float r2 = gaussRand(); + + fftw_complex r1r2; + init_complex(r1r2, r1, r2); + mul_complex_f(o->_h0[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); + mul_complex_f(o->_h0_minus[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i],-o->_kz[j]) / 2.0f))); + } + } + + o->_fft_in = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in"); + o->_htilda = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_htilda"); + + if (o->_do_disp_y){ + o->_disp_y = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y"); + o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE); + } + + if (o->_do_normals){ o->_fft_in_nx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nx"); o->_fft_in_nz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nz"); - - o->_N_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_x"); - /*o->_N_y = (float*) fftwf_malloc(o->_M * o->_N * sizeof(float)); (MEM01)*/ - o->_N_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_z"); - - o->_N_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nx, o->_N_x, FFTW_ESTIMATE); - o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE); - } - - if (o->_do_chop){ + + o->_N_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_x"); + /*o->_N_y = (float*) fftwf_malloc(o->_M * o->_N * sizeof(float)); (MEM01)*/ + o->_N_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_z"); + + o->_N_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nx, o->_N_x, FFTW_ESTIMATE); + o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE); + } + + if (o->_do_chop){ o->_fft_in_x = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_x"); o->_fft_in_z = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_z"); - - o->_disp_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_x"); - o->_disp_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_z"); - - o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE); - o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE); - } - if (o->_do_jacobian){ + + o->_disp_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_x"); + o->_disp_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_z"); + + o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE); + o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE); + } + if (o->_do_jacobian){ o->_fft_in_jxx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxx"); o->_fft_in_jzz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jzz"); o->_fft_in_jxz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxz"); - - o->_Jxx = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxx"); - o->_Jzz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jzz"); - o->_Jxz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxz"); - - o->_Jxx_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxx, o->_Jxx, FFTW_ESTIMATE); - o->_Jzz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jzz, o->_Jzz, FFTW_ESTIMATE); - o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE); - } - - BLI_rw_mutex_unlock(&o->oceanmutex); - - set_height_normalize_factor(o); - -} -void BKE_free_ocean_data(struct Ocean *oc) + o->_Jxx = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxx"); + o->_Jzz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jzz"); + o->_Jxz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxz"); + + o->_Jxx_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxx, o->_Jxx, FFTW_ESTIMATE); + o->_Jzz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jzz, o->_Jzz, FFTW_ESTIMATE); + o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE); + } + + BLI_rw_mutex_unlock(&o->oceanmutex); + + set_height_normalize_factor(o); + +} + +void BKE_free_ocean_data(struct Ocean *oc) { if(!oc) return; - + BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE); - + if (oc->_do_disp_y) { fftw_destroy_plan(oc->_disp_y_plan); MEM_freeN(oc->_disp_y); } - + if (oc->_do_normals) { MEM_freeN(oc->_fft_in_nx); @@ -935,7 +936,7 @@ void BKE_free_ocean_data(struct Ocean *oc) /*fftwf_free(oc->_N_y); (MEM01)*/ MEM_freeN(oc->_N_z); } - + if (oc->_do_chop) { MEM_freeN(oc->_fft_in_x); @@ -945,7 +946,7 @@ void BKE_free_ocean_data(struct Ocean *oc) MEM_freeN(oc->_disp_x); MEM_freeN(oc->_disp_z); } - + if (oc->_do_jacobian) { MEM_freeN(oc->_fft_in_jxx); @@ -958,10 +959,10 @@ void BKE_free_ocean_data(struct Ocean *oc) MEM_freeN(oc->_Jzz); MEM_freeN(oc->_Jxz); } - + if (oc->_fft_in) MEM_freeN(oc->_fft_in); - + /* check that ocean data has been initialised */ if (oc->_htilda) { MEM_freeN(oc->_htilda); @@ -971,17 +972,17 @@ void BKE_free_ocean_data(struct Ocean *oc) MEM_freeN(oc->_kx); MEM_freeN(oc->_kz); } - + BLI_rw_mutex_unlock(&oc->oceanmutex); } -void BKE_free_ocean(struct Ocean *oc) +void BKE_free_ocean(struct Ocean *oc) { if(!oc) return; - + BKE_free_ocean_data(oc); BLI_rw_mutex_end(&oc->oceanmutex); - + MEM_freeN(oc); } @@ -999,19 +1000,19 @@ static void cache_filename(char *string, const char *path, int frame, int type) { char cachepath[FILE_MAX]; const char *fname; - + switch(type) { - case CACHE_TYPE_FOAM: - fname= "foam_"; - break; - case CACHE_TYPE_NORMAL: - fname= "normal_"; - break; - case CACHE_TYPE_DISPLACE: - default: - fname= "disp_"; - break; - } + case CACHE_TYPE_FOAM: + fname= "foam_"; + break; + case CACHE_TYPE_NORMAL: + fname= "normal_"; + break; + case CACHE_TYPE_DISPLACE: + default: + fname= "disp_"; + break; + } BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); @@ -1021,9 +1022,9 @@ static void cache_filename(char *string, const char *path, int frame, int type) void BKE_free_ocean_cache(struct OceanCache *och) { int i, f=0; - + if (!och) return; - + if (och->ibufs_disp) { for (i=och->start, f=0; i<=och->end; i++, f++) { @@ -1033,7 +1034,7 @@ void BKE_free_ocean_cache(struct OceanCache *och) } MEM_freeN(och->ibufs_disp); } - + if (och->ibufs_foam) { for (i=och->start, f=0; i<=och->end; i++, f++) { @@ -1043,7 +1044,7 @@ void BKE_free_ocean_cache(struct OceanCache *och) } MEM_freeN(och->ibufs_foam); } - + if (och->ibufs_norm) { for (i=och->start, f=0; i<=och->end; i++, f++) { @@ -1053,7 +1054,7 @@ void BKE_free_ocean_cache(struct OceanCache *och) } MEM_freeN(och->ibufs_norm); } - + if (och->time) MEM_freeN(och->time); MEM_freeN(och); @@ -1064,27 +1065,27 @@ void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, in int res_x = och->resolution_x; int res_y = och->resolution_y; float result[4]; - + u = fmod(u, 1.0); v = fmod(v, 1.0); - + if (u < 0) u += 1.0f; - if (v < 0) v += 1.0f; - + if (v < 0) v += 1.0f; + if (och->ibufs_disp[f]) { - ibuf_sample(och->ibufs_disp[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ibuf_sample(och->ibufs_disp[f], u, v, (1.0f/(float)res_x), (1.0f/(float)res_y), result); ocr->disp[0] = result[0]; ocr->disp[1] = result[1]; ocr->disp[2] = result[2]; } - + if (och->ibufs_foam[f]) { - ibuf_sample(och->ibufs_foam[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ibuf_sample(och->ibufs_foam[f], u, v, (1.0f/(float)res_x), (1.0f/(float)res_y), result); ocr->foam = result[0]; } - + if (och->ibufs_norm[f]) { - ibuf_sample(och->ibufs_norm[f], u, v, (1.0/(float)res_x), (1.0/(float)res_y), result); + ibuf_sample(och->ibufs_norm[f], u, v, (1.0f/(float)res_x), (1.0f/(float)res_y), result); ocr->normal[0] = result[0]; ocr->normal[1] = result[1]; ocr->normal[2] = result[2]; @@ -1092,23 +1093,23 @@ void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, in } void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j) -{ +{ int res_x = och->resolution_x; int res_y = och->resolution_y; - + i = abs(i) % res_x; - j = abs(j) % res_y; + j = abs(j) % res_y; if (och->ibufs_disp[f]) { ocr->disp[0] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 0]; ocr->disp[1] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 1]; ocr->disp[2] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 2]; } - + if (och->ibufs_foam[f]) { ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i) + 0]; } - + if (och->ibufs_norm[f]) { ocr->normal[0] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 0]; ocr->normal[1] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 1]; @@ -1116,11 +1117,11 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, in } } -struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, +struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, float chop_amount, float foam_coverage, float foam_fade, int resolution) { OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); - + och->bakepath = bakepath; och->start = start; och->end = end; @@ -1135,9 +1136,9 @@ struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, floa och->ibufs_disp = MEM_callocN(sizeof(ImBuf *)*och->duration, "displacement imbuf pointer array"); och->ibufs_foam = MEM_callocN(sizeof(ImBuf *)*och->duration, "foam imbuf pointer array"); och->ibufs_norm = MEM_callocN(sizeof(ImBuf *)*och->duration, "normal imbuf pointer array"); - + och->time = NULL; - + return och; } @@ -1145,26 +1146,26 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame) { char string[FILE_MAX]; int f = frame; - + /* ibufs array is zero based, but filenames are based on frame numbers */ /* still need to clamp frame numbers to valid range of images on disk though */ CLAMP(frame, och->start, och->end); f = frame - och->start; // shift to 0 based - + /* if image is already loaded in mem, return */ if (och->ibufs_disp[f] != NULL ) return; - - + + cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE); och->ibufs_disp[f] = IMB_loadiffname(string, 0); //if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string); //else printf("loaded cache %s \n", string); - + cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM); och->ibufs_foam[f] = IMB_loadiffname(string, 0); //if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string); //else printf("loaded cache %s \n", string); - + cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL); och->ibufs_norm[f] = IMB_loadiffname(string, 0); //if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string); @@ -1182,91 +1183,91 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v int res_x = och->resolution_x; int res_y = och->resolution_y; char string[FILE_MAX]; - + if (!o) return; - + prev_foam = MEM_callocN(res_x*res_y*sizeof(float), "previous frame foam bake data"); - + BLI_srand(0); - + for (f=och->start, i=0; f<=och->end; f++, i++) { - + /* create a new imbuf to store image for this frame */ ibuf_foam = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); ibuf_disp = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); ibuf_normal = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat); - + ibuf_disp->profile = ibuf_foam->profile = ibuf_normal->profile = IB_PROFILE_LINEAR_RGB; - + BKE_simulate_ocean(o, och->time[i], och->wave_scale, och->chop_amount); - + /* add new foam */ for (y=0; y < res_y; y++) { for (x=0; x < res_x; x++) { - float r, pr=0.0, foam_result; + float r, pr=0.0f, foam_result; float neg_disp, neg_eplus; - + BKE_ocean_eval_ij(o, &ocr, x, y); - + normalize_v3(ocr.normal); - + /* foam */ ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage); - + /* accumulate previous value for this cell */ if (i>0) pr = prev_foam[res_x*y + x]; r = BLI_frand(); // randomly reduce foam - + //pr = pr * och->foam_fade; // overall fade - + // remember ocean coord sys is Y up! - // break up the foam where height (Y) is low (wave valley), + // break up the foam where height (Y) is low (wave valley), // and X and Z displacement is greatest - + /* vec[0] = ocr.disp[0]; vec[1] = ocr.disp[2]; hor_stretch = len_v2(vec); CLAMP(hor_stretch, 0.0, 1.0); */ - - neg_disp = ocr.disp[1]<0.0?1.0+ocr.disp[1]:1.0; - neg_disp = neg_disp<0.0?0.0:neg_disp; - - neg_eplus = ocr.Eplus[2]<0.0?1.0+ocr.Eplus[2]:1.0; - neg_eplus = neg_eplus<0.0?0.0:neg_eplus; + + neg_disp = ocr.disp[1] < 0.0f ? 1.0f+ocr.disp[1] : 1.0f; + neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp; + + neg_eplus = ocr.Eplus[2] < 0.0f ? 1.0f + ocr.Eplus[2]:1.0f; + neg_eplus = neg_eplus<0.0f ? 0.0f : neg_eplus; //if (ocr.disp[1] < 0.0 || r > och->foam_fade) // pr *= och->foam_fade; - - + + //pr = pr * (1.0 - hor_stretch) * ocr.disp[1]; //pr = pr * neg_disp * neg_eplus; - - if (pr < 1.0) pr *=pr; - - pr *= och->foam_fade * (0.75+neg_eplus*0.25); - - + + if (pr < 1.0f) pr *=pr; + + pr *= och->foam_fade * (0.75f + neg_eplus * 0.25f); + + foam_result = pr + ocr.foam; - + prev_foam[res_x*y + x] = foam_result; - + /* add to the image */ ibuf_disp->rect_float[4*(res_x*y + x) + 0] = ocr.disp[0]; ibuf_disp->rect_float[4*(res_x*y + x) + 1] = ocr.disp[1]; ibuf_disp->rect_float[4*(res_x*y + x) + 2] = ocr.disp[2]; - ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 1.0; - + ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 1.0f; + if (o->_do_jacobian) { ibuf_foam->rect_float[4*(res_x*y + x) + 0] = foam_result; ibuf_foam->rect_float[4*(res_x*y + x) + 1] = foam_result; ibuf_foam->rect_float[4*(res_x*y + x) + 2] = foam_result; ibuf_foam->rect_float[4*(res_x*y + x) + 3] = 1.0; } - + if (o->_do_normals) { ibuf_normal->rect_float[4*(res_x*y + x) + 0] = ocr.normal[0]; ibuf_normal->rect_float[4*(res_x*y + x) + 1] = ocr.normal[1]; @@ -1276,38 +1277,38 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v } } - + /* write the images */ cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE); if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Displacement File Output to %s\n", string); - + if (o->_do_jacobian) { cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM); if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Foam File Output to %s\n", string); } - + if (o->_do_normals) { cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL); if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Normal File Output to %s\n", string); } - + IMB_freeImBuf(ibuf_disp); IMB_freeImBuf(ibuf_foam); IMB_freeImBuf(ibuf_normal); - + progress = (f - och->start) / (float)och->duration; - + update_cb(update_cb_data, progress, &cancel); - + if (cancel) { MEM_freeN(prev_foam); return; } } - + MEM_freeN(prev_foam); och->baked = 1; } @@ -1316,7 +1317,7 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v /* stub */ typedef struct Ocean { - /* need some data here, C does not allow empty struct */ + /* need some data here, C does not allow empty struct */ int stub; } Ocean; @@ -1357,16 +1358,16 @@ struct Ocean *BKE_add_ocean(void) return oc; } -void BKE_init_ocean(struct Ocean* UNUSED(o), int UNUSED(M),int UNUSED(N), float UNUSED(Lx), float UNUSED(Lz), float UNUSED(V), float UNUSED(l), float UNUSED(A), float UNUSED(w), float UNUSED(damp), +void BKE_init_ocean(struct Ocean* UNUSED(o), int UNUSED(M),int UNUSED(N), float UNUSED(Lx), float UNUSED(Lz), float UNUSED(V), float UNUSED(l), float UNUSED(A), float UNUSED(w), float UNUSED(damp), float UNUSED(alignment), float UNUSED(depth), float UNUSED(time), short UNUSED(do_height_field), short UNUSED(do_chop), short UNUSED(do_normals), short UNUSED(do_jacobian), int UNUSED(seed)) { } -void BKE_free_ocean_data(struct Ocean *UNUSED(oc)) +void BKE_free_ocean_data(struct Ocean *UNUSED(oc)) { } -void BKE_free_ocean(struct Ocean *oc) +void BKE_free_ocean(struct Ocean *oc) { if(!oc) return; MEM_freeN(oc); @@ -1379,7 +1380,7 @@ void BKE_free_ocean(struct Ocean *oc) void BKE_free_ocean_cache(struct OceanCache *och) { if (!och) return; - + MEM_freeN(och); } @@ -1388,14 +1389,14 @@ void BKE_ocean_cache_eval_uv(struct OceanCache *UNUSED(och), struct OceanResult } void BKE_ocean_cache_eval_ij(struct OceanCache *UNUSED(och), struct OceanResult *UNUSED(ocr), int UNUSED(f), int UNUSED(i), int UNUSED(j)) -{ +{ } -struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale), +struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale), float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution)) { OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); - + return och; } diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 2c921f2000f..9cc2d367d66 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -48,7 +48,7 @@ #ifdef WITH_OCEANSIM static void init_cache_data(struct OceanModifierData *omd) { - omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, + omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); } @@ -63,17 +63,17 @@ static void clear_cache_data(struct OceanModifierData *omd) static void init_ocean_modifier(struct OceanModifierData *omd) { int do_heightfield, do_chop, do_normals, do_jacobian; - - if (!omd || !omd->ocean) return; - + + if (!omd || !omd->ocean) return; + do_heightfield = TRUE; do_chop = (omd->chop_amount > 0); do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); do_jacobian = (omd->flag & MOD_OCEAN_GENERATE_FOAM); - + BKE_free_ocean_data(omd->ocean); - BKE_init_ocean(omd->ocean, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size, - omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment, + BKE_init_ocean(omd->ocean, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size, + omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment, omd->depth, omd->time, do_heightfield, do_chop, do_normals, do_jacobian, omd->seed); @@ -82,7 +82,7 @@ static void init_ocean_modifier(struct OceanModifierData *omd) static void simulate_ocean_modifier(struct OceanModifierData *omd) { if (!omd || !omd->ocean) return; - + BKE_simulate_ocean(omd->ocean, omd->time, omd->wave_scale, omd->chop_amount); } #endif // WITH_OCEANSIM @@ -95,29 +95,29 @@ static void initData(ModifierData *md) { #ifdef WITH_OCEANSIM OceanModifierData *omd = (OceanModifierData*) md; - - omd->resolution = 7; + + omd->resolution = 7; omd->spatial_size = 50; - + omd->wave_alignment = 0.0; omd->wind_velocity = 30.0; - + omd->damp = 0.5; omd->smallest_wave = 0.01; omd->wave_direction= 0.0; omd->depth = 200.0; - + omd->wave_scale = 1.0; - + omd->chop_amount = 1.0; - + omd->foam_coverage = 0.0; - + omd->seed = 0; omd->time = 1.0; - + omd->refresh = 0; - + omd->size = 1.0; omd->repeat_x = 1; omd->repeat_y = 1; @@ -129,7 +129,7 @@ static void initData(ModifierData *md) omd->bakeend = 250; omd->oceancache = NULL; omd->foam_fade = 0.98; - + omd->ocean = BKE_add_ocean(); init_ocean_modifier(omd); simulate_ocean_modifier(omd); @@ -158,41 +158,41 @@ static void copyData(ModifierData *md, ModifierData *target) #ifdef WITH_OCEANSIM OceanModifierData *omd = (OceanModifierData*) md; OceanModifierData *tomd = (OceanModifierData*) target; - + tomd->resolution = omd->resolution; tomd->spatial_size = omd->spatial_size; - + tomd->wind_velocity = omd->wind_velocity; - + tomd->damp = omd->damp; tomd->smallest_wave = omd->smallest_wave; tomd->depth = omd->depth; - + tomd->wave_alignment = omd->wave_alignment; tomd->wave_direction = omd->wave_direction; tomd->wave_scale = omd->wave_scale; - + tomd->chop_amount = omd->chop_amount; - tomd->foam_coverage = omd->foam_coverage; + tomd->foam_coverage = omd->foam_coverage; tomd->time = omd->time; - + tomd->seed = omd->seed; tomd->flag = omd->flag; tomd->output = omd->output; - + tomd->refresh = 0; - + tomd->size = omd->size; tomd->repeat_x = omd->repeat_x; tomd->repeat_y = omd->repeat_y; - + /* XXX todo: copy cache runtime too */ tomd->cached = 0; tomd->bakestart = omd->bakestart; tomd->bakeend = omd->bakeend; tomd->oceancache = NULL; - + tomd->ocean = BKE_add_ocean(); init_ocean_modifier(tomd); simulate_ocean_modifier(tomd); @@ -224,32 +224,32 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) #endif // WITH_OCEANSIM #if 0 -static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, float *oy) +static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, float *oy) { /* get bounding box of underlying dm */ int v, totvert=dm->getNumVerts(dm); float min[3], max[3], delta[3]; - + MVert *mvert = dm->getVertDataArray(dm,0); - + copy_v3_v3(min, mvert->co); copy_v3_v3(max, mvert->co); - + for(v=1; vco[0]); min[1]=MIN2(min[1],mvert->co[1]); min[2]=MIN2(min[2],mvert->co[2]); - + max[0]=MAX2(max[0],mvert->co[0]); max[1]=MAX2(max[1],mvert->co[1]); max[2]=MAX2(max[2],mvert->co[2]); } - + sub_v3_v3v3(delta, max, min); - + *sx = delta[0]; *sy = delta[1]; - + *ox = min[0]; *oy = min[1]; } @@ -260,47 +260,47 @@ MINLINE float ocean_co(OceanModifierData *omd, float v) { //float scale = 1.0 / (omd->size * omd->spatial_size); //*v = (*v * scale) + 0.5; - - return (v / (omd->size * omd->spatial_size)) + 0.5; + + return (v / (omd->size * omd->spatial_size)) + 0.5f; } #define OMP_MIN_RES 18 static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) { DerivedMesh *result; - + MVert *mv; MFace *mf; MTFace *tf; - + int cdlayer; - + const int rx = omd->resolution*omd->resolution; const int ry = omd->resolution*omd->resolution; const int res_x = rx * omd->repeat_x; const int res_y = ry * omd->repeat_y; - + const int num_verts = (res_x + 1) * (res_y + 1); const int num_edges = (res_x * res_y * 2) + res_x + res_y; const int num_faces = res_x * res_y; - + float sx = omd->size * omd->spatial_size; float sy = omd->size * omd->spatial_size; - const float ox = -sx / 2.0; - const float oy = -sy / 2.0; - + const float ox = -sx / 2.0f; + const float oy = -sy / 2.0f; + float ix, iy; - + int x, y; - + sx /= rx; sy /= ry; - + result = CDDM_new(num_verts, num_edges, num_faces); - + mv = CDDM_get_verts(result); mf = CDDM_get_faces(result); - + /* create vertices */ #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) for (y=0; y < res_y+1; y++) { @@ -311,7 +311,7 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) mv[i].co[2] = 0; } } - + /* create faces */ #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) for (y=0; y < res_y; y++) { @@ -322,20 +322,20 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) mf[fi].v2 = vi + 1; mf[fi].v3 = vi + 1 + res_x+1; mf[fi].v4 = vi + res_x+1; - + mf[fi].flag |= ME_SMOOTH; } } - + CDDM_calc_edges(result); - + /* add uvs */ cdlayer= CustomData_number_of_layers(&result->faceData, CD_MTFACE); if(cdlayer >= MAX_MTFACE) return result; CustomData_add_layer(&result->faceData, CD_MTFACE, CD_CALLOC, NULL, num_faces); tf = CustomData_get_layer(&result->faceData, CD_MTFACE); - + ix = 1.0 / rx; iy = 1.0 / ry; #pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES) @@ -344,13 +344,13 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) const int i = y*res_x + x; tf[i].uv[0][0] = x * ix; tf[i].uv[0][1] = y * iy; - + tf[i].uv[1][0] = (x+1) * ix; tf[i].uv[1][1] = y * iy; - + tf[i].uv[2][0] = (x+1) * ix; tf[i].uv[2][1] = (y+1) * iy; - + tf[i].uv[3][0] = x * ix; tf[i].uv[3][1] = (y+1) * iy; } @@ -364,22 +364,22 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), int UNUSED(useRenderParams)) { OceanModifierData *omd = (OceanModifierData*) md; - + DerivedMesh *dm=NULL; OceanResult ocr; - + MVert *mv; MFace *mf; - + int cdlayer; - + int i, j; int num_verts; int num_faces; int cfra; - + /* update modifier */ if (omd->refresh & MOD_OCEAN_REFRESH_ADD) omd->ocean = BKE_add_ocean(); @@ -387,9 +387,9 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), init_ocean_modifier(omd); if (omd->refresh & MOD_OCEAN_REFRESH_CLEAR_CACHE) clear_cache_data(omd); - + omd->refresh = 0; - + /* do ocean simulation */ if (omd->cached == TRUE) { if (!omd->oceancache) init_cache_data(omd); @@ -397,44 +397,44 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), } else { simulate_ocean_modifier(omd); } - + if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) dm = generate_ocean_geometry(omd); else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) { dm = CDDM_copy(derivedData); } - + cfra = md->scene->r.cfra; CLAMP(cfra, omd->bakestart, omd->bakeend); cfra -= omd->bakestart; // shift to 0 based - + num_verts = dm->getNumVerts(dm); num_faces = dm->getNumFaces(dm); - + /* add vcols before displacement - allows lookup based on position */ - + if (omd->flag & MOD_OCEAN_GENERATE_FOAM) { MCol *mc; float foam; char cf; - + float u=0.0, v=0.0; - + cdlayer= CustomData_number_of_layers(&dm->faceData, CD_MCOL); if(cdlayer >= MAX_MCOL) return dm; - + CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces); - + mc = dm->getFaceDataArray(dm, CD_MCOL); mv = dm->getVertArray(dm); mf = dm->getFaceArray(dm); - + for (i = 0; i < num_faces; i++, mf++) { for (j=0; j<4; j++) { if (j == 3 && !mf->v4) continue; - + switch(j) { case 0: u = ocean_co(omd, mv[mf->v1].co[0]); @@ -454,11 +454,11 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), break; } - + if (omd->oceancache && omd->cached==TRUE) { BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); foam = ocr.foam; - CLAMP(foam, 0.0, 1.0); + CLAMP(foam, 0.0f, 1.0f); } else { BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage); @@ -470,25 +470,25 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), } } } - - + + /* displace the geometry */ - + mv = dm->getVertArray(dm); - + //#pragma omp parallel for private(i, ocr) if (omd->resolution > OMP_MIN_RES) for (i=0; i< num_verts; i++) { const float u = ocean_co(omd, mv[i].co[0]); const float v = ocean_co(omd, mv[i].co[1]); - + if (omd->oceancache && omd->cached==TRUE) BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); else BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); - + mv[i].co[2] += ocr.disp[1]; - - if (omd->chop_amount > 0.0) { + + if (omd->chop_amount > 0.0f) { mv[i].co[0] += ocr.disp[0]; mv[i].co[1] += ocr.disp[2]; } @@ -514,12 +514,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, int UNUSED(isFinalCalc)) { DerivedMesh *result; - + result = doOcean(md, ob, derivedData, 0); - + if(result != derivedData) CDDM_calc_normals(result); - + return result; } diff --git a/source/blender/render/intern/source/texture_ocean.c b/source/blender/render/intern/source/texture_ocean.c index 95985eb7f2b..fe63b51b150 100644 --- a/source/blender/render/intern/source/texture_ocean.c +++ b/source/blender/render/intern/source/texture_ocean.c @@ -1,4 +1,4 @@ -/* +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -64,55 +64,55 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) int cfra = R.r.cfra; int normals= 0; ModifierData *md; - + texres->tin = 0.0f; - + if (!ot || !ot->object || !ot->object->modifiers.first) return 0; - + if ((md = (ModifierData *)modifiers_findByType(ot->object, eModifierType_Ocean))) { OceanModifierData *omd = (OceanModifierData *)md; - + if (!omd->ocean) return 0; normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); - + if (omd->oceancache && omd->cached==TRUE) { - + CLAMP(cfra, omd->bakestart, omd->bakeend); cfra -= omd->bakestart; // shift to 0 based - + BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); - + } else { // non-cached - + if (G.rendering) BKE_ocean_eval_uv_catrom(omd->ocean, &ocr, u, v); else BKE_ocean_eval_uv(omd->ocean, &ocr, u, v); - + ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage); } } - - + + switch (ot->output) { case TEX_OCN_DISPLACEMENT: /* XYZ displacement */ texres->tr = 0.5f + 0.5f * ocr.disp[0]; texres->tg = 0.5f + 0.5f * ocr.disp[2]; texres->tb = 0.5f + 0.5f * ocr.disp[1]; - + texres->tr = MAX2(0.0f, texres->tr); texres->tg = MAX2(0.0f, texres->tg); texres->tb = MAX2(0.0f, texres->tb); BRICONTRGB; - + retval = TEX_RGB; break; - + case TEX_OCN_EMINUS: /* -ve eigenvectors ? */ texres->tr = ocr.Eminus[0]; @@ -120,7 +120,7 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) texres->tb = ocr.Eminus[1]; retval = TEX_RGB; break; - + case TEX_OCN_EPLUS: /* -ve eigenvectors ? */ texres->tr = ocr.Eplus[0]; @@ -128,18 +128,18 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) texres->tb = ocr.Eplus[1]; retval = TEX_RGB; break; - + case TEX_OCN_JPLUS: texres->tin = ocr.Jplus; retval = TEX_INT; break; case TEX_OCN_FOAM: - + texres->tin = ocr.foam; BRICONT; - + retval = TEX_INT; break; } @@ -150,9 +150,8 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) normalize_v3_v3(texres->nor, ocr.normal); retval |= TEX_NOR; } - + texres->ta = 1.0f; - + return retval; } - From fbf9406785f28b647b3fb062390ed477fa1cffce Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 13 Nov 2011 16:24:15 +0000 Subject: [PATCH 028/203] Release cycle: Moving on to BCon 3: beta --- source/blender/blenkernel/BKE_blender.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index b150c403b87..24cbe4dc954 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -49,9 +49,9 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR a +#define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE alpha +#define BLENDER_VERSION_CYCLE beta struct ListBase; struct MemFile; From c993ee678a3438a26c263a78ade71f8013f03160 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Nov 2011 16:28:52 +0000 Subject: [PATCH 029/203] new math utility function isect_plane_plane_v3 --- source/blender/blenlib/BLI_math_geom.h | 23 ++++++++++++++++--- source/blender/blenlib/intern/math_geom.c | 23 ++++++++++++++++++- .../blenlib/intern/math_vector_inline.c | 6 ++--- source/blender/makesrna/intern/rna_modifier.c | 4 ++-- .../python/mathutils/mathutils_geometry.c | 1 + 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 99687ae8bb4..5c92d15c440 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -60,7 +60,7 @@ float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]); float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]); -float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2]); +float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); @@ -92,9 +92,11 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[ * */ int isect_line_line_v3(const float v1[3], const float v2[3], - const float v3[3], const float v4[3], float i1[3], float i2[3]); + const float v3[3], const float v4[3], + float i1[3], float i2[3]); int isect_line_line_strict_v3(const float v1[3], const float v2[3], - const float v3[3], const float v4[3], float vi[3], float *lambda); + const float v3[3], const float v4[3], + float vi[3], float *lambda); /*if clip is nonzero, will only return true if lambda is >= 0.0 (i.e. intersection point is along positive d)*/ @@ -113,6 +115,21 @@ int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3], const short no_flip); +/** + * Intersect two planes, return a point on the intersection and a vector + * that runs on the direction of the intersection. + * Return error code is the same as 'isect_line_line_v3'. + * @param r_isect_co The resulting intersection point. + * @param r_isect_no The resulting vector of the intersection. + * @param plane_a_co The point on the first plane. + * @param plane_a_no The normal of the first plane. + * @param plane_b_co The point on the second plane. + * @param plane_b_no The normal of the second plane. + */ +int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], + const float plane_a_co[3], const float plane_a_no[3], + const float plane_b_co[3], const float plane_b_no[3]); + /* line/ray triangle */ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index a135cb43882..6fc3891d1bd 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -238,7 +238,7 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float } /* signed distance from the point to the plane in 3D */ -float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2]) +float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]) { float plane_no_unit[3]; float plane_co_other[3]; @@ -833,6 +833,27 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons } } +int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], + const float plane_a_co[3], const float plane_a_no[3], + const float plane_b_co[3], const float plane_b_no[3]) +{ + float p1_co_other[3], p2_co_other[3]; + float isect_co_dummy[3]; + + cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no); + cross_v3_v3v3(p1_co_other, plane_a_no, r_isect_no); + cross_v3_v3v3(p2_co_other, plane_b_no, r_isect_no); + + add_v3_v3(p1_co_other, plane_a_co); + add_v3_v3(p2_co_other, plane_b_co); + + /* we could use either ix_1, ix_2 - doesnt matter in this case */ + return isect_line_line_v3(plane_a_co, p1_co_other, + plane_b_co, p2_co_other, + r_isect_co, isect_co_dummy); +} + + /* Adapted from the paper by Kasper Fauerby */ /* "Improved Collision detection and Response" */ static int getLowestRoot(const float a, const float b, const float c, const float maxR, float *root) diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 1c7d131c750..4570bd5e99e 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -181,19 +181,19 @@ MINLINE void add_v4_fl(float r[4], float f) r[3] += f; } -MINLINE void add_v2_v2(float *r, const float *a) +MINLINE void add_v2_v2(float r[2], const float a[2]) { r[0] += a[0]; r[1] += a[1]; } -MINLINE void add_v2_v2v2(float *r, const float *a, const float *b) +MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]) { r[0]= a[0] + b[0]; r[1]= a[1] + b[1]; } -MINLINE void add_v3_v3(float *r, const float *a) +MINLINE void add_v3_v3(float r[3], const float a[3]) { r[0] += a[0]; r[1] += a[1]; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b50f755b6c7..0752a781ca7 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -695,8 +695,8 @@ static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value) omd->chop_amount = value; - if ((old_value == 0.0 && value > 0.0) || - (old_value > 0.0 && value == 0.0)) + if ((old_value == 0.0f && value > 0.0f) || + (old_value > 0.0f && value == 0.0f)) { omd->refresh |= MOD_OCEAN_REFRESH_RESET; omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index c2487db707c..dfa1c98b94b 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1213,6 +1213,7 @@ static PyMethodDef M_Geometry_methods[]= { {"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc}, {"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc}, {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc}, + /* TODO: isect_plane_plane_v3 --> intersect_plane_plane */ {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc}, From b9cc1f7590a2dd4d473900d20369015f0bb80778 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 13 Nov 2011 16:38:14 +0000 Subject: [PATCH 030/203] Quiting a warning in Ocean code (commenting out var). --- source/blender/blenkernel/intern/ocean.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 76b5d37bad8..7ce8ec69845 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1204,7 +1204,7 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v /* add new foam */ for (y=0; y < res_y; y++) { for (x=0; x < res_x; x++) { - float r, pr=0.0f, foam_result; + float /*r,*/ /* UNUSED */ pr=0.0f, foam_result; float neg_disp, neg_eplus; BKE_ocean_eval_ij(o, &ocr, x, y); @@ -1218,7 +1218,7 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v if (i>0) pr = prev_foam[res_x*y + x]; - r = BLI_frand(); // randomly reduce foam + /* r = BLI_frand(); */ /* UNUSED */ // randomly reduce foam //pr = pr * och->foam_fade; // overall fade From 36898304849fb9d29b189f0b0a7e6931492efcc1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 17:16:04 +0000 Subject: [PATCH 031/203] Camera solving: fixed incorrect warnings about failure of solving some frames Error was caused y not very accurate calculating which frames should be solved. --- source/blender/blenkernel/intern/tracking.c | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 65b27f725bc..d65840720cd 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1289,8 +1289,27 @@ static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reco } if(track->markersnr) { - if(track->markers[0].framenrmarkers[0].framenr; - if(track->markers[track->markersnr-1].framenr>efra) efra= track->markers[track->markersnr-1].framenr; + int first= 0, last= track->markersnr; + MovieTrackingMarker *first_marker= &track->markers[0]; + MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1]; + + /* find first not-disabled marker */ + while(firstmarkersnr-1 && first_marker->flag&MARKER_DISABLED) { + first++; + first_marker++; + } + + /* find last not-disabled marker */ + while(last>=0 && last_marker->flag&MARKER_DISABLED) { + last--; + last_marker--; + } + + if(firstmarkersnr-1) + sfra= MIN2(sfra, first_marker->framenr); + + if(last>=0) + efra= MAX2(efra, last_marker->framenr); } track= track->next; From c491b8bf459bcb3bdc1e73fbe3c1f95ff096c335 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 13 Nov 2011 17:45:42 +0000 Subject: [PATCH 032/203] Fix #29240: multi-res bake broken in 2.60 Use preview subdivision level even when in sculpt mode. Makes more sense than baking against sculpting subdivision level. --- source/blender/editors/object/object_bake.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 2d5f0b5ff2b..63a316e7f7b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -987,8 +987,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); Mesh *me= (Mesh*)ob->data; - if(ob->mode==OB_MODE_SCULPT) *lvl= mmd->sculptlvl; - else *lvl= mmd->lvl; + *lvl= mmd->lvl; if(*lvl==0) { DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob); From fea58943ecf32daa5bd828656d5e1157e6de984a Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 13 Nov 2011 18:03:27 +0000 Subject: [PATCH 033/203] Moving all node angle-type values to radians. This also fixes [#29151] rotate node wrong input (mixing up radians and degrees). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warning! Angles in nodes have just been moved to consistant Radians values (ANGLE subtype of RNA Float property). You will still see them as degrees in the GUI, though, unless you chose otherwise in Scene properties, Units panel. Conversion from degrees to radians for old files is obviously done at loading time, but if you use a mixed pipeline of trunk and releases, be carefull! Loading a 2.60.4 file (or higher) into any previous version of Blender, your angles in nodes will have odd values (well, radians interpreted as degrees)! And if you save such file in a pre-2.60.4 version, the angle node values will be converted again when loaded in Blender 2.60.4 or higher... This affects following nodes: * Compo: Rotate, Defocus, ChromaMatte, Glare and DirectionalBlur * Shader: Mapping And all future code using the TexMapping struct’s rotation part (its rot memember is now in radians). --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenkernel/intern/texture.c | 8 +- source/blender/blenloader/intern/readfile.c | 74 ++++++++++++++++++- source/blender/makesdna/DNA_node_types.h | 6 +- source/blender/makesdna/DNA_texture_types.h | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 30 ++++---- source/blender/makesrna/intern/rna_texture.c | 2 +- .../nodes/node_composite_chromaMatte.c | 8 +- .../composite/nodes/node_composite_defocus.c | 7 +- .../nodes/node_composite_directionalblur.c | 4 +- .../composite/nodes/node_composite_glare.c | 8 +- .../composite/nodes/node_composite_rotate.c | 2 +- 12 files changed, 112 insertions(+), 41 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 24cbe4dc954..dd7285d36a8 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 260 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index fcaeacd2eb4..db4d09e38b3 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -229,7 +229,7 @@ void default_tex_mapping(TexMapping *texmap) void init_tex_mapping(TexMapping *texmap) { - float eul[3], smat[3][3], rmat[3][3], mat[3][3], proj[3][3]; + float smat[3][3], rmat[3][3], mat[3][3], proj[3][3]; if(texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z && is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) { @@ -252,10 +252,8 @@ void init_tex_mapping(TexMapping *texmap) size_to_mat3(smat, texmap->size); /* rotation */ - eul[0]= DEG2RADF(texmap->rot[0]); - eul[1]= DEG2RADF(texmap->rot[1]); - eul[2]= DEG2RADF(texmap->rot[2]); - eul_to_mat3( rmat,eul); + /* XXX TexMapping rotation are now in radians. */ + eul_to_mat3(rmat, texmap->rot); /* compose it all */ mul_m3_m3m3(mat, rmat, smat); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 53df4bbecfa..1c4a4567401 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7301,6 +7301,52 @@ static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id), } } +static void do_versions_nodetree_convert_angle(bNodeTree *ntree) +{ + bNode *node; + for (node=ntree->nodes.first; node; node=node->next) { + if (node->type == CMP_NODE_ROTATE) { + /* Convert degrees to radians. */ + bNodeSocket *sock = ((bNodeSocket*)node->inputs.first)->next; + ((bNodeSocketValueFloat*)sock->default_value)->value = DEG2RADF(((bNodeSocketValueFloat*)sock->default_value)->value); + } + else if (node->type == CMP_NODE_DBLUR) { + /* Convert degrees to radians. */ + NodeDBlurData *ndbd= node->storage; + ndbd->angle = DEG2RADF(ndbd->angle); + ndbd->spin = DEG2RADF(ndbd->spin); + } + else if (node->type == CMP_NODE_DEFOCUS) { + /* Convert degrees to radians. */ + NodeDefocus *nqd = node->storage; + /* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */ + nqd->rotation = DEG2RADF(nqd->rotation*255.0f); + } + else if (node->type == CMP_NODE_CHROMA_MATTE) { + /* Convert degrees to radians. */ + NodeChroma *ndc = node->storage; + ndc->t1 = DEG2RADF(ndc->t1); + ndc->t2 = DEG2RADF(ndc->t2); + } + else if (node->type == CMP_NODE_GLARE) { + /* Convert degrees to radians. */ + NodeGlare* ndg = node->storage; + /* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */ + ndg->angle_ofs = DEG2RADF(ndg->angle_ofs*255.0f); + } + /* XXX TexMapping struct is used by other nodes too (at least node_composite_mapValue), + * but not the rot part... + */ + else if (node->type == SH_NODE_MAPPING) { + /* Convert degrees to radians. */ + TexMapping* tmap = node->storage; + tmap->rot[0] = DEG2RADF(tmap->rot[0]); + tmap->rot[1] = DEG2RADF(tmap->rot[1]); + tmap->rot[2] = DEG2RADF(tmap->rot[2]); + } + } +} + static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ @@ -12412,9 +12458,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260); } - /* put compatibility code here until next subversion bump */ - { + if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)){ { + /* Convert node angles to radians! */ + Scene *sce; + Material *mat; + bNodeTree *ntree; + + for (sce=main->scene.first; sce; sce=sce->id.next) { + if (sce->nodetree) + do_versions_nodetree_convert_angle(sce->nodetree); + } + + for (mat=main->mat.first; mat; mat=mat->id.next) { + if (mat->nodetree) + do_versions_nodetree_convert_angle(mat->nodetree); + } + + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) + do_versions_nodetree_convert_angle(ntree); + } + + { + /* Tomato compatibility code. */ bScreen *sc; MovieClip *clip; @@ -12475,6 +12541,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + /* put compatibility code here until next subversion bump */ + { + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 07c2885eff7..1897f8a0353 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -376,9 +376,10 @@ typedef struct NodeVertexCol { /* qdn: Defocus blur node */ typedef struct NodeDefocus { - char bktype, rotation, preview, gamco; + char bktype, pad_c1, preview, gamco; short samples, no_zbuf; float fstop, maxblur, bthresh, scale; + float rotation, pad_f1; } NodeDefocus; typedef struct NodeScriptDict { @@ -389,8 +390,9 @@ typedef struct NodeScriptDict { /* qdn: glare node */ typedef struct NodeGlare { char quality, type, iter; - char angle, angle_ofs, size, pad[2]; + char angle, pad_c1, size, pad[2]; float colmod, mix, threshold, fade; + float angle_ofs, pad_f1; } NodeGlare; /* qdn: tonemap node */ diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index ece99c8fc86..619df428f7c 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -278,7 +278,7 @@ typedef struct Tex { } Tex; -/* used for mapping and texture nodes. note: rot is in degrees */ +/* used for mapping and texture nodes. note: rot is now in radians */ typedef struct TexMapping { float loc[3], rot[3], size[3]; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 55693f8e53f..35ba9984c79 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1928,17 +1928,17 @@ static void def_cmp_chroma_matte(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); - prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "t1"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); - RNA_def_property_range(prop, 1.0f, 80.0f); + RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f)); RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); - RNA_def_property_range(prop, 0.0f, 30.0f); + RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f)); RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -2103,9 +2103,9 @@ static void def_cmp_defocus(StructRNA *srna) RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); /* TODO: angle in degrees */ - prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "rotation"); - RNA_def_property_range(prop, 0, 90); + prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "rotation"); + RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f)); RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -2271,15 +2271,15 @@ static void def_cmp_dblur(StructRNA *srna) RNA_def_property_ui_text(prop, "Distance", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "angle"); - RNA_def_property_range(prop, 0.0f, 360.0f); + RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f)); RNA_def_property_ui_text(prop, "Angle", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "spin"); - RNA_def_property_range(prop, -360.0f, 360.0f); + RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f)); RNA_def_property_ui_text(prop, "Spin", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -2393,10 +2393,10 @@ static void def_cmp_glare(StructRNA *srna) RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "angle_offset", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "angle_ofs"); - RNA_def_property_range(prop, 0, 180); - RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees"); + prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "angle_ofs"); + RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); + RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 249bdb4a366..dfbfac75f8c 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -472,7 +472,7 @@ static void rna_def_texmapping(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Location", ""); RNA_def_property_update(prop, 0, "rna_Texture_mapping_update"); - prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_XYZ); /* Not PROP_EUL, this is already in degrees, not radians */ + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */ RNA_def_property_float_sdna(prop, NULL, "rot"); RNA_def_property_ui_text(prop, "Rotation", ""); RNA_def_property_update(prop, 0, "rna_Texture_mapping_update"); diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 9aadfdf363b..0005d9d2cc9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -102,7 +102,7 @@ static void do_chroma_key(bNode *node, float *out, float *in) z=in[2]*cosf(theta)-in[1]*sinf(theta); /*if within the acceptance angle */ - angle=c->t1*(float)M_PI/180.0f; /* convert to radians */ + angle=c->t1; /* t1 is radians. */ /* if kfg is <0 then the pixel is outside of the key color */ kfg= x-(fabsf(z)/tanf(angle/2.0f)); @@ -115,7 +115,7 @@ static void do_chroma_key(bNode *node, float *out, float *in) alpha=(1.0f-kfg)*(c->fstrength); beta=atan2(z,x); - angle2=c->t2*(float)(M_PI/180.0); + angle2=c->t2; /* t2 is radians. */ /* if beta is within the cutoff angle */ if(fabsf(beta) < (angle2/2.0f)) { @@ -180,8 +180,8 @@ static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode* nod { NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); node->storage= c; - c->t1= 30.0f; - c->t2= 10.0f; + c->t1= DEG2RADF(30.0f); + c->t2= DEG2RADF(10.0f); c->t3= 0.0f; c->fsize= 0.0f; c->fstrength= 1.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 9b32e0f6f3f..515d24dcc51 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -58,8 +58,9 @@ typedef struct BokehCoeffs { static void makeBokeh(char bktype, char ro, int* len_bkh, float* inradsq, BokehCoeffs BKH[8], float bkh_b[4]) { float x0, x1, y0, y1, dx, dy, iDxy; - float w = MAX2(1e-5f, ro)*(float)(M_PI/180); // never reported stangely enough, but a zero offset causes missing center line... - float wi = (360.f/bktype)*(float)(M_PI/180); + /* ro now is in radians. */ + float w = MAX2(1e-6f, ro); // never reported stangely enough, but a zero offset causes missing center line... + float wi = DEG2RADF(360.f/bktype); int i, ov, nv; // bktype must be at least 3 & <= 8 @@ -862,7 +863,7 @@ static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bN /* qdn: defocus node */ NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data"); nbd->bktype = 0; - nbd->rotation = 0.f; + nbd->rotation = 0.0f; nbd->preview = 1; nbd->gamco = 0; nbd->samples = 16; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 802ef2d8e12..04610150356 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -47,7 +47,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, { if ((dist != 0.f) || (spin != 0.f) || (zoom != 0.f)) { void (*getpix)(CompBuf*, float, float, float*) = wrap ? qd_getPixelLerpWrap : qd_getPixelLerp; - const float a= angle * (float)M_PI / 180.f; + const float a= angle; const float itsc= 1.f / powf(2.f, (float)iterations); float D; float center_x_pix, center_y_pix; @@ -65,7 +65,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, tx= itsc * D * cosf(a); ty= -itsc * D * sinf(a); sc= itsc * zoom; - rot= itsc * spin * (float)M_PI / 180.f; + rot= itsc * spin; /* blur the image */ for(i= 0; i < iterations; ++i) { diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index b7cc1d3c92d..296ad2e3a5b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -238,7 +238,7 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) int x, y, n; unsigned int nump=0; fRGB c1, c2, c3, c4; - float a, ang = 360.f/(float)ndg->angle; + float a, ang = DEG2RADF(360.0f)/(float)ndg->angle; bsrc = BTP(src, ndg->threshold, 1 << ndg->quality); tsrc = dupalloc_compbuf(bsrc); // sample from buffer @@ -246,8 +246,8 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) sbuf = alloc_compbuf(tsrc->x, tsrc->y, tsrc->type, 1); // streak sum buffer - for (a=0.f; a<360.f; a+=ang) { - const float an = (a + (float)ndg->angle_ofs)*(float)M_PI/180.f; + for (a=0.f; aangle_ofs; const float vx = cos((double)an), vy = sin((double)an); for (n=0; niter; ++n) { const float p4 = pow(4.0, (double)n); @@ -483,7 +483,7 @@ static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode* node, bNod ndg->mix = 0; ndg->threshold = 1; ndg->angle = 4; - ndg->angle_ofs = 0; + ndg->angle_ofs = 0.0f; ndg->fade = 0.9; ndg->size = 8; node->storage = ndg; diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 730c53a1a29..d02602c7d04 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -58,7 +58,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac int x, y, yo, xo; ImBuf *ibuf, *obuf; - rad= ((float)M_PI*in[1]->vec[0])/180.0f; + rad= in[1]->vec[0]; s= sin(rad); From a34fed3f2c1924c1487c4e159d3825697b08841c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 03:54:23 +0000 Subject: [PATCH 034/203] VIEW3D_OT_camera_to_view_selected operator to move the camera to frame all selected, renderable objects. --- release/scripts/startup/bl_ui/space_view3d.py | 1 + source/blender/blenkernel/BKE_camera.h | 5 + source/blender/blenkernel/BKE_object.h | 11 ++ source/blender/blenkernel/intern/camera.c | 107 ++++++++++++++++++ source/blender/blenkernel/intern/object.c | 63 +++++++++++ .../editors/space_view3d/view3d_intern.h | 3 +- .../blender/editors/space_view3d/view3d_ops.c | 3 +- .../editors/space_view3d/view3d_view.c | 55 ++++++++- 8 files changed, 243 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9ca542103ad..32ac4284267 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -366,6 +366,7 @@ class VIEW3D_MT_view_align(Menu): layout.operator("view3d.view_all", text="Center Cursor and View All").center = True layout.operator("view3d.camera_to_view", text="Align Active Camera to View") + layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected") layout.operator("view3d.view_selected") layout.operator("view3d.view_center_cursor") diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index d21c1092922..fc0ef0248f3 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -41,6 +41,7 @@ struct Object; struct RenderData; struct Scene; struct rctf; +struct View3D; void *add_camera(const char *name); struct Camera *copy_camera(struct Camera *cam); @@ -63,6 +64,10 @@ void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float draw void camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]); +int camera_view_frame_fit_to_scene( + struct Scene *scene, struct View3D *v3d, struct Object *camera_ob, + float r_co[3]); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index ecc00901dd5..cb79c7a7290 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -110,6 +110,17 @@ void object_set_dimensions(struct Object *ob, const float *value); void object_boundbox_flag(struct Object *ob, int flag, int set); void minmax_object(struct Object *ob, float min[3], float max[3]); int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max); + +/* sometimes min-max isnt enough, we need to loop over each point */ +void BKE_object_foreach_display_point( + struct Object *ob, float obmat[4][4], + void (*func_cb)(const float[3], void *), void *user_data); +void BKE_scene_foreach_display_point( + struct Scene *scene, + struct View3D *v3d, + const short flag, + void (*func_cb)(const float[3], void *), void *user_data); + void solve_tracking (struct Object *ob, float targetmat[][4]); int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 145eb9363e9..0f973273b32 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -41,6 +41,7 @@ #include "BKE_animsys.h" #include "BKE_camera.h" +#include "BKE_object.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" @@ -394,3 +395,109 @@ void camera_view_frame(Scene *scene, Camera *camera, float r_vec[4][3]) dummy_asp, dummy_shift, &dummy_drawsize, r_vec); } + +typedef struct CameraViewFrameData { + float frame_tx[4][3]; + float normal_tx[4][3]; + float dist_vals[4]; + unsigned int tot; +} CameraViewFrameData; + +static void camera_to_frame_view_cb(const float co[3], void *user_data) +{ + CameraViewFrameData *data= (CameraViewFrameData *)user_data; + unsigned int i; + + for (i= 0; i < 4; i++) { + float nd= -dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]); + if (nd < data->dist_vals[i]) { + data->dist_vals[i]= nd; + } + } + + data->tot++; +} + +/* dont move the camera, just yield the fit location */ +int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3]) +{ + float plane_tx[4][3]; + float rot_obmat[3][3]; + const float zero[3]= {0,0,0}; + CameraViewFrameData data_cb; + + unsigned int i; + + camera_view_frame(scene, camera_ob->data, data_cb.frame_tx); + + copy_m3_m4(rot_obmat, camera_ob->obmat); + normalize_m3(rot_obmat); + + for (i= 0; i < 4; i++) { + mul_m3_v3(rot_obmat, data_cb.frame_tx[i]); + } + + for (i= 0; i < 4; i++) { + normal_tri_v3(data_cb.normal_tx[i], + zero, data_cb.frame_tx[i], data_cb.frame_tx[(i + 1) % 4]); + } + + /* initialize callback data */ + data_cb.dist_vals[0]= + data_cb.dist_vals[1]= + data_cb.dist_vals[2]= + data_cb.dist_vals[3]= FLT_MAX; + data_cb.tot= 0; + /* run callback on all visible points */ + BKE_scene_foreach_display_point(scene, v3d, BA_SELECT, + camera_to_frame_view_cb, &data_cb); + + if (data_cb.tot <= 1) { + return FALSE; + } + else { + float plane_isect_1[3], plane_isect_1_other[3]; + float plane_isect_2[3], plane_isect_2_other[3]; + + float plane_isect_pt_1[3], plane_isect_pt_2[3]; + + /* apply the dist-from-plane's to the transformed plane points */ + for (i= 0; i < 4; i++) { + mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]); + } + + if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_other, + plane_tx[0], data_cb.normal_tx[0], + plane_tx[2], data_cb.normal_tx[2]) == 0) || + (isect_plane_plane_v3(plane_isect_2, plane_isect_2_other, + plane_tx[1], data_cb.normal_tx[1], + plane_tx[3], data_cb.normal_tx[3]) == 0)) + { + /* this is very unlikely */ + return FALSE; + } + else { + + add_v3_v3(plane_isect_1_other, plane_isect_1); + add_v3_v3(plane_isect_2_other, plane_isect_2); + + if (isect_line_line_v3(plane_isect_1, plane_isect_1_other, + plane_isect_2, plane_isect_2_other, + plane_isect_pt_1, plane_isect_pt_2) == 0) + { + return FALSE; + } + else { + float cam_plane_no[3]= {0.0f, 0.0f, -1.0f}; + float tvec[3]; + mul_m3_v3(rot_obmat, cam_plane_no); + + sub_v3_v3v3(tvec, plane_isect_pt_2, plane_isect_pt_1); + copy_v3_v3(r_co, dot_v3v3(tvec, cam_plane_no) > 0.0f ? + plane_isect_pt_1 : plane_isect_pt_2); + + return TRUE; + } + } + } +} diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 4e6bc4eee89..ffd49ecc57d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2333,6 +2333,69 @@ int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max) return ok; } +void BKE_object_foreach_display_point( + Object *ob, float obmat[4][4], + void (*func_cb)(const float[3], void *), void *user_data) +{ + float co[3]; + + if (ob->derivedFinal) { + DerivedMesh *dm= ob->derivedFinal; + MVert *mv= dm->getVertArray(dm); + int totvert= dm->getNumVerts(dm); + int i; + + for (i= 0; i < totvert; i++, mv++) { + mul_v3_m4v3(co, obmat, mv->co); + func_cb(co, user_data); + } + } + else if (ob->disp.first) { + DispList *dl; + + for (dl=ob->disp.first; dl; dl=dl->next) { + float *v3= dl->verts; + int totvert= dl->nr; + int i; + + for (i= 0; i < totvert; i++, v3+=3) { + mul_v3_m4v3(co, obmat, v3); + func_cb(co, user_data); + } + } + } +} + +void BKE_scene_foreach_display_point( + Scene *scene, View3D *v3d, const short flag, + void (*func_cb)(const float[3], void *), void *user_data) +{ + Base *base; + Object *ob; + + for(base= FIRSTBASE; base; base = base->next) { + if(BASE_VISIBLE(v3d, base) && (base->flag & flag) == flag) { + ob= base->object; + + if ((ob->transflag & OB_DUPLI)==0) { + BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data); + } + else { + ListBase *lb; + DupliObject *dob; + + lb= object_duplilist(scene, ob); + for(dob= lb->first; dob; dob= dob->next) { + if(dob->no_draw == 0) { + BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data); + } + } + free_object_duplilist(lb); /* does restore */ + } + } + } +} + /* copied from DNA_object_types.h */ typedef struct ObTfmBack { float loc[3], dloc[3], orig[3]; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index fa2d5db21df..775cb45066a 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -155,7 +155,8 @@ void VIEW3D_OT_select_border(struct wmOperatorType *ot); void VIEW3D_OT_select_lasso(struct wmOperatorType *ot); void VIEW3D_OT_smoothview(struct wmOperatorType *ot); -void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot); +void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot); +void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot); void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot); void VIEW3D_OT_localview(struct wmOperatorType *ot); void VIEW3D_OT_game_start(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 6e26fb15873..aeb850243c5 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -85,7 +85,8 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_enable_manipulator); WM_operatortype_append(VIEW3D_OT_cursor3d); WM_operatortype_append(VIEW3D_OT_select_lasso); - WM_operatortype_append(VIEW3D_OT_setcameratoview); + WM_operatortype_append(VIEW3D_OT_camera_to_view); + WM_operatortype_append(VIEW3D_OT_camera_to_view_selected); WM_operatortype_append(VIEW3D_OT_object_as_camera); WM_operatortype_append(VIEW3D_OT_localview); WM_operatortype_append(VIEW3D_OT_game_start); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index cc0e93740ea..d2d6d6b0959 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -43,6 +43,7 @@ #include "BKE_anim.h" #include "BKE_action.h" +#include "BKE_camera.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_object.h" @@ -406,9 +407,8 @@ static int view3d_setcameratoview_poll(bContext *C) return 0; } -void VIEW3D_OT_setcameratoview(wmOperatorType *ot) +void VIEW3D_OT_camera_to_view(wmOperatorType *ot) { - /* identifiers */ ot->name= "Align Camera To View"; ot->description= "Set camera view to active view"; @@ -422,6 +422,55 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* unlike VIEW3D_OT_view_selected this is for framing a render and not + * meant to take into account vertex/bone selection for eg. */ +static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene= CTX_data_scene(C); + View3D *v3d = CTX_wm_view3d(C); + Object *camera_ob= v3d->camera; + + float r_co[3]; /* the new location to apply */ + + /* this function does all the important stuff */ + if (camera_view_frame_fit_to_scene(scene, v3d, camera_ob, r_co)) { + + ObjectTfmProtectedChannels obtfm; + float obmat_new[4][4]; + + copy_m4_m4(obmat_new, camera_ob->obmat); + copy_v3_v3(obmat_new[3], r_co); + + /* only touch location */ + object_tfm_protected_backup(camera_ob, &obtfm); + object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE); + object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D); + + /* notifiers */ + DAG_id_tag_update(&camera_ob->id, OB_RECALC_OB); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, camera_ob); + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } +} + +void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Camera Fit Frame to Selected"; + ot->description= "Move the camera so selected objects are framed"; + ot->idname= "VIEW3D_OT_camera_to_view_selected"; + + /* api callbacks */ + ot->exec= view3d_camera_to_view_selected_exec; + // ot->poll= view3d_setcameratoview_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -461,7 +510,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) ot->idname= "VIEW3D_OT_object_as_camera"; /* api callbacks */ - ot->exec= view3d_setobjectascamera_exec; + ot->exec= view3d_setobjectascamera_exec; ot->poll= ED_operator_rv3d_unlock_poll; /* flags */ From 6c3e4b77bf3693f3e63d1437c4375b96bd009bbf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 05:52:06 +0000 Subject: [PATCH 035/203] Fix #29245: BuilderBot can't build anymore Buildbot is using different settings for blender and player, enable fftw library in rules for player now. --- build_files/buildbot/config/user-config-i686.py | 3 +++ build_files/buildbot/config/user-config-player-i686.py | 5 +++++ build_files/buildbot/config/user-config-player-x86_64.py | 5 +++++ build_files/buildbot/config/user-config-x86_64.py | 3 +++ 4 files changed, 16 insertions(+) diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py index eb3e321140f..99af7f3fa04 100644 --- a/build_files/buildbot/config/user-config-i686.py +++ b/build_files/buildbot/config/user-config-i686.py @@ -109,6 +109,9 @@ BF_BOOST_INC = '${BF_BOOST}/include' BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a' BF_BOOST_LIBPATH = '${BF_BOOST}/lib' +# Ocean Simulation +WITH_BF_OCEANSIM = True + # Compilation and optimization BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py index fc875831223..3445ae59bda 100644 --- a/build_files/buildbot/config/user-config-player-i686.py +++ b/build_files/buildbot/config/user-config-player-i686.py @@ -86,6 +86,11 @@ WITH_BF_JACK = True # Motion Tracking WITH_BF_LIBMV = False +# Ocean Simulation +WITH_BF_FFTW3 = True +WITH_BF_STATICFFTW3 = True +WITH_BF_OCEANSIM = True + # Compilation and optimization BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py index 64dc93608d9..6ec56865c26 100644 --- a/build_files/buildbot/config/user-config-player-x86_64.py +++ b/build_files/buildbot/config/user-config-player-x86_64.py @@ -86,6 +86,11 @@ WITH_BF_JACK = True # Motion Tracking WITH_BF_LIBMV = False +# Ocean Simulation +WITH_BF_FFTW3 = True +WITH_BF_STATICFFTW3 = True +WITH_BF_OCEANSIM = True + # Compilation and optimization BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py index e7667b6c2ca..a607be286f9 100644 --- a/build_files/buildbot/config/user-config-x86_64.py +++ b/build_files/buildbot/config/user-config-x86_64.py @@ -109,6 +109,9 @@ BF_BOOST_INC = '${BF_BOOST}/include' BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a' BF_BOOST_LIBPATH = '${BF_BOOST}/lib' +# Ocean Simulation +WITH_BF_OCEANSIM = True + # Compilation and optimization BF_DEBUG = False REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ From bb934ad883b31dcd19f0cc161deabb3943acf9b8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 05:55:50 +0000 Subject: [PATCH 036/203] Ocean baking was using uninitialized memory, but further investigation it was calculating foam values when they were not used. avoid calculating foam and allocating memory when its not needed. --- source/blender/blenkernel/intern/implicit.c | 2 +- source/blender/blenkernel/intern/ocean.c | 115 ++++++++++-------- .../render/intern/source/convertblender.c | 2 +- 3 files changed, 64 insertions(+), 55 deletions(-) diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index df3694e0bf1..00a2de369a3 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1814,7 +1814,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float /*compute forces*/ sub_v3_v3v3(vec, cos[i], cv->tx); - mul_v3_fl(vec, cv->mass*dt*20.0); + mul_v3_fl(vec, cv->mass*dt*20.0f); add_v3_v3(cv->tv, vec); //copy_v3_v3(cv->tx, cos[i]); } diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 7ce8ec69845..df4cd94cf38 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -490,6 +490,8 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j) ocr->normal[0] = oc->_N_x[i*oc->_N+j]; ocr->normal[1] = oc->_N_y/*oc->_N_y[i*oc->_N+j] (MEM01)*/; ocr->normal[2] = oc->_N_z[i*oc->_N+j]; + + normalize_v3(ocr->normal); } if (oc->_do_jacobian) @@ -1175,9 +1177,14 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame) void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data) { + /* note: some of these values remain uninitialized unless certain options + * are enabled, take care that BKE_ocean_eval_ij() initializes a member + * before use - campbell */ + OceanResult ocr; + int f, i=0, x, y, cancel=0; float progress; - OceanResult ocr; + ImBuf *ibuf_foam, *ibuf_disp, *ibuf_normal; float *prev_foam; int res_x = och->resolution_x; @@ -1186,7 +1193,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v if (!o) return; - prev_foam = MEM_callocN(res_x*res_y*sizeof(float), "previous frame foam bake data"); + if (o->_do_jacobian) prev_foam = MEM_callocN(res_x*res_y*sizeof(float), "previous frame foam bake data"); + else prev_foam = NULL; BLI_srand(0); @@ -1204,57 +1212,9 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v /* add new foam */ for (y=0; y < res_y; y++) { for (x=0; x < res_x; x++) { - float /*r,*/ /* UNUSED */ pr=0.0f, foam_result; - float neg_disp, neg_eplus; BKE_ocean_eval_ij(o, &ocr, x, y); - normalize_v3(ocr.normal); - - /* foam */ - ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage); - - /* accumulate previous value for this cell */ - if (i>0) - pr = prev_foam[res_x*y + x]; - - /* r = BLI_frand(); */ /* UNUSED */ // randomly reduce foam - - //pr = pr * och->foam_fade; // overall fade - - // remember ocean coord sys is Y up! - // break up the foam where height (Y) is low (wave valley), - // and X and Z displacement is greatest - - /* - vec[0] = ocr.disp[0]; - vec[1] = ocr.disp[2]; - hor_stretch = len_v2(vec); - CLAMP(hor_stretch, 0.0, 1.0); - */ - - neg_disp = ocr.disp[1] < 0.0f ? 1.0f+ocr.disp[1] : 1.0f; - neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp; - - neg_eplus = ocr.Eplus[2] < 0.0f ? 1.0f + ocr.Eplus[2]:1.0f; - neg_eplus = neg_eplus<0.0f ? 0.0f : neg_eplus; - - //if (ocr.disp[1] < 0.0 || r > och->foam_fade) - // pr *= och->foam_fade; - - - //pr = pr * (1.0 - hor_stretch) * ocr.disp[1]; - //pr = pr * neg_disp * neg_eplus; - - if (pr < 1.0f) pr *=pr; - - pr *= och->foam_fade * (0.75f + neg_eplus * 0.25f); - - - foam_result = pr + ocr.foam; - - prev_foam[res_x*y + x] = foam_result; - /* add to the image */ ibuf_disp->rect_float[4*(res_x*y + x) + 0] = ocr.disp[0]; ibuf_disp->rect_float[4*(res_x*y + x) + 1] = ocr.disp[1]; @@ -1262,6 +1222,56 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 1.0f; if (o->_do_jacobian) { + /* TODO, cleanup unused code - campbell */ + + float /*r,*/ /* UNUSED */ pr=0.0f, foam_result; + float neg_disp, neg_eplus; + + ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage); + + /* accumulate previous value for this cell */ + if (i > 0) { + pr = prev_foam[res_x*y + x]; + } + + /* r = BLI_frand(); */ /* UNUSED */ // randomly reduce foam + + //pr = pr * och->foam_fade; // overall fade + + // remember ocean coord sys is Y up! + // break up the foam where height (Y) is low (wave valley), + // and X and Z displacement is greatest + + /* + vec[0] = ocr.disp[0]; + vec[1] = ocr.disp[2]; + hor_stretch = len_v2(vec); + CLAMP(hor_stretch, 0.0, 1.0); + */ + + neg_disp = ocr.disp[1] < 0.0f ? 1.0f+ocr.disp[1] : 1.0f; + neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp; + + /* foam, 'ocr.Eplus' only initialized with do_jacobian */ + neg_eplus = ocr.Eplus[2] < 0.0f ? 1.0f + ocr.Eplus[2]:1.0f; + neg_eplus = neg_eplus<0.0f ? 0.0f : neg_eplus; + + //if (ocr.disp[1] < 0.0 || r > och->foam_fade) + // pr *= och->foam_fade; + + + //pr = pr * (1.0 - hor_stretch) * ocr.disp[1]; + //pr = pr * neg_disp * neg_eplus; + + if (pr < 1.0f) pr *=pr; + + pr *= och->foam_fade * (0.75f + neg_eplus * 0.25f); + + + foam_result = pr + ocr.foam; + + prev_foam[res_x*y + x] = foam_result; + ibuf_foam->rect_float[4*(res_x*y + x) + 0] = foam_result; ibuf_foam->rect_float[4*(res_x*y + x) + 1] = foam_result; ibuf_foam->rect_float[4*(res_x*y + x) + 2] = foam_result; @@ -1274,7 +1284,6 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v ibuf_normal->rect_float[4*(res_x*y + x) + 2] = ocr.normal[2]; ibuf_normal->rect_float[4*(res_x*y + x) + 3] = 1.0; } - } } @@ -1304,12 +1313,12 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v update_cb(update_cb_data, progress, &cancel); if (cancel) { - MEM_freeN(prev_foam); + if (prev_foam) MEM_freeN(prev_foam); return; } } - MEM_freeN(prev_foam); + if (prev_foam) MEM_freeN(prev_foam); och->baked = 1; } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 440c7170341..ba2d245dbd6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5264,7 +5264,7 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con if(vec[0]<0.0f) ang= -ang; zco[0]= ang/pixelphix + zmulx; - ang= 0.5f*M_PI - saacos(vec[1]/sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); + ang= 0.5f*(float)M_PI - saacos(vec[1]/sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])); zco[1]= ang/pixelphiy + zmuly; } From e058110b700d556710509d20deac778a6b4d566f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 06:11:40 +0000 Subject: [PATCH 037/203] fix uninitialized memory use when an object has modifiers but no ocean modifier. --- .../render/intern/source/texture_ocean.c | 148 +++++++++--------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/source/blender/render/intern/source/texture_ocean.c b/source/blender/render/intern/source/texture_ocean.c index fe63b51b150..c13347dc162 100644 --- a/source/blender/render/intern/source/texture_ocean.c +++ b/source/blender/render/intern/source/texture_ocean.c @@ -56,27 +56,27 @@ extern struct Render R; /* ***** actual texture sampling ***** */ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) { - int retval = TEX_INT; OceanTex *ot= tex->ot; - OceanResult ocr; - const float u = 0.5f+0.5f*texvec[0]; - const float v = 0.5f+0.5f*texvec[1]; - int cfra = R.r.cfra; - int normals= 0; ModifierData *md; + OceanModifierData *omd; texres->tin = 0.0f; - if (!ot || !ot->object || !ot->object->modifiers.first) + if ( !(ot) || + !(ot->object) || + !(md = (ModifierData *)modifiers_findByType(ot->object, eModifierType_Ocean)) || + !(omd= (OceanModifierData *)md)->ocean) + { return 0; + } + else { + const int do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); + int cfra = R.r.cfra; + int retval = TEX_INT; - if ((md = (ModifierData *)modifiers_findByType(ot->object, eModifierType_Ocean))) { - OceanModifierData *omd = (OceanModifierData *)md; - - if (!omd->ocean) - return 0; - - normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS); + OceanResult ocr; + const float u = 0.5f+0.5f*texvec[0]; + const float v = 0.5f+0.5f*texvec[1]; if (omd->oceancache && omd->cached==TRUE) { @@ -85,7 +85,8 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v); - } else { // non-cached + } + else { // non-cached if (G.rendering) BKE_ocean_eval_uv_catrom(omd->ocean, &ocr, u, v); @@ -94,64 +95,63 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres) ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage); } + + switch (ot->output) { + case TEX_OCN_DISPLACEMENT: + /* XYZ displacement */ + texres->tr = 0.5f + 0.5f * ocr.disp[0]; + texres->tg = 0.5f + 0.5f * ocr.disp[2]; + texres->tb = 0.5f + 0.5f * ocr.disp[1]; + + texres->tr = MAX2(0.0f, texres->tr); + texres->tg = MAX2(0.0f, texres->tg); + texres->tb = MAX2(0.0f, texres->tb); + + BRICONTRGB; + + retval = TEX_RGB; + break; + + case TEX_OCN_EMINUS: + /* -ve eigenvectors ? */ + texres->tr = ocr.Eminus[0]; + texres->tg = ocr.Eminus[2]; + texres->tb = ocr.Eminus[1]; + retval = TEX_RGB; + break; + + case TEX_OCN_EPLUS: + /* -ve eigenvectors ? */ + texres->tr = ocr.Eplus[0]; + texres->tg = ocr.Eplus[2]; + texres->tb = ocr.Eplus[1]; + retval = TEX_RGB; + break; + + case TEX_OCN_JPLUS: + texres->tin = ocr.Jplus; + retval = TEX_INT; + break; + + case TEX_OCN_FOAM: + + texres->tin = ocr.foam; + + BRICONT; + + retval = TEX_INT; + break; + } + + /* if normals needed */ + + if (texres->nor && do_normals) { + normalize_v3_v3(texres->nor, ocr.normal); + retval |= TEX_NOR; + } + + texres->ta = 1.0f; + + return retval; } - - - switch (ot->output) { - case TEX_OCN_DISPLACEMENT: - /* XYZ displacement */ - texres->tr = 0.5f + 0.5f * ocr.disp[0]; - texres->tg = 0.5f + 0.5f * ocr.disp[2]; - texres->tb = 0.5f + 0.5f * ocr.disp[1]; - - texres->tr = MAX2(0.0f, texres->tr); - texres->tg = MAX2(0.0f, texres->tg); - texres->tb = MAX2(0.0f, texres->tb); - - BRICONTRGB; - - retval = TEX_RGB; - break; - - case TEX_OCN_EMINUS: - /* -ve eigenvectors ? */ - texres->tr = ocr.Eminus[0]; - texres->tg = ocr.Eminus[2]; - texres->tb = ocr.Eminus[1]; - retval = TEX_RGB; - break; - - case TEX_OCN_EPLUS: - /* -ve eigenvectors ? */ - texres->tr = ocr.Eplus[0]; - texres->tg = ocr.Eplus[2]; - texres->tb = ocr.Eplus[1]; - retval = TEX_RGB; - break; - - case TEX_OCN_JPLUS: - texres->tin = ocr.Jplus; - retval = TEX_INT; - break; - - case TEX_OCN_FOAM: - - texres->tin = ocr.foam; - - BRICONT; - - retval = TEX_INT; - break; - } - - /* if normals needed */ - - if (texres->nor && normals) { - normalize_v3_v3(texres->nor, ocr.normal); - retval |= TEX_NOR; - } - - texres->ta = 1.0f; - - return retval; } From 6fbc4186fd947d5dd408fccea1ba4990be738880 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 06:41:23 +0000 Subject: [PATCH 038/203] Assorted camera tracker improvements - Add support for refining the camera's intrinsic parameters during a solve. Currently, refining supports only the following combinations of intrinsic parameters: f f, cx, cy f, cx, cy, k1, k2 f, k1 f, k1, k2 This is not the same as autocalibration, since the user must still make a reasonable initial guess about the focal length and other parameters, whereas true autocalibration would eliminate the need for the user specify intrinsic parameters at all. However, the solver works well with only rough guesses for the focal length, so perhaps full autocalibation is not that important. Adding support for the last two combinations, (f, k1) and (f, k1, k2) required changes to the library libmv depends on for bundle adjustment, SSBA. These changes should get ported upstream not just to libmv but to SSBA as well. - Improved the region of convergence for bundle adjustment by increasing the number of Levenberg-Marquardt iterations from 50 to 500. This way, the solver is able to crawl out of the bad local minima it gets stuck in when changing from, for example, bundling k1 and k2 to just k1 and resetting k2 to 0. - Add several new region tracker implementations. A region tracker is a libmv concept, which refers to tracking a template image pattern through frames. The impact to end users is that tracking should "just work better". I am reserving a more detailed writeup, and maybe a paper, for later. - Other libmv tweaks, such as detecting that a tracker is headed outside of the image bounds. This includes several changes made directly to the libmv extern code rather expecting to get those changes through normal libmv channels, because I, the libmv BDFL, decided it was faster to work on libmv directly in Blender, then later reverse-port the libmv changes from Blender back into libmv trunk. The interesting part is that I added a full Levenberg-Marquardt loop to the region tracking code, which should lead to a more stable solutions. I also added a hacky implementation of "Efficient Second-Order Minimization" for tracking, which works nicely. A more detailed quantitative evaluation will follow. Original patch by Keir, cleaned a bit by myself. --- extern/libmv/CMakeLists.txt | 4 + extern/libmv/libmv-capi.cpp | 76 ++++- extern/libmv/libmv-capi.h | 15 +- extern/libmv/libmv/simple_pipeline/bundle.cc | 121 ++++++-- extern/libmv/libmv/simple_pipeline/bundle.h | 41 +++ .../simple_pipeline/camera_intrinsics.cc | 22 ++ .../libmv/simple_pipeline/camera_intrinsics.h | 16 +- .../initialize_reconstruction.cc | 2 + .../libmv/libmv/simple_pipeline/pipeline.cc | 1 - .../libmv/tracking/esm_region_tracker.cc | 288 ++++++++++++++++++ .../libmv/libmv/tracking/esm_region_tracker.h | 61 ++++ .../libmv/tracking/klt_region_tracker.cc | 78 +++-- .../libmv/tracking/lmicklt_region_tracker.cc | 265 ++++++++++++++++ .../libmv/tracking/lmicklt_region_tracker.h | 62 ++++ .../libmv/tracking/pyramid_region_tracker.cc | 33 +- .../libmv/tracking/trklt_region_tracker.cc | 40 +++ .../ssba/Geometry/v3d_metricbundle.cpp | 40 +++ .../ssba/Geometry/v3d_metricbundle.h | 28 +- release/scripts/startup/bl_ui/space_clip.py | 4 + source/blender/blenkernel/BKE_tracking.h | 2 + source/blender/blenkernel/intern/tracking.c | 86 +++++- .../blender/editors/space_clip/tracking_ops.c | 24 +- source/blender/makesdna/DNA_tracking_types.h | 11 + source/blender/makesrna/intern/rna_tracking.c | 24 ++ 24 files changed, 1237 insertions(+), 107 deletions(-) create mode 100644 extern/libmv/libmv/tracking/esm_region_tracker.cc create mode 100644 extern/libmv/libmv/tracking/esm_region_tracker.h create mode 100644 extern/libmv/libmv/tracking/lmicklt_region_tracker.cc create mode 100644 extern/libmv/libmv/tracking/lmicklt_region_tracker.h diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index 333791e28eb..cd1f572197c 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -52,8 +52,10 @@ set(SRC libmv/image/array_nd.cc libmv/tracking/pyramid_region_tracker.cc libmv/tracking/sad.cc + libmv/tracking/esm_region_tracker.cc libmv/tracking/trklt_region_tracker.cc libmv/tracking/klt_region_tracker.cc + libmv/tracking/lmicklt_region_tracker.cc libmv/tracking/retrack_region_tracker.cc libmv/multiview/projection.cc libmv/multiview/conditioning.cc @@ -99,8 +101,10 @@ set(SRC libmv/tracking/retrack_region_tracker.h libmv/tracking/sad.h libmv/tracking/pyramid_region_tracker.h + libmv/tracking/esm_region_tracker.h libmv/tracking/trklt_region_tracker.h libmv/tracking/klt_region_tracker.h + libmv/tracking/lmicklt_region_tracker.h libmv/base/id_generator.h libmv/base/vector.h libmv/base/scoped_ptr.h diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp index 2e007bb47b2..4d17aa6f538 100644 --- a/extern/libmv/libmv-capi.cpp +++ b/extern/libmv/libmv-capi.cpp @@ -33,8 +33,10 @@ #include "glog/logging.h" #include "Math/v3d_optimization.h" +#include "libmv/tracking/esm_region_tracker.h" #include "libmv/tracking/klt_region_tracker.h" #include "libmv/tracking/trklt_region_tracker.h" +#include "libmv/tracking/lmicklt_region_tracker.h" #include "libmv/tracking/pyramid_region_tracker.h" #include "libmv/tracking/sad.h" @@ -47,6 +49,7 @@ #include "libmv/simple_pipeline/camera_intrinsics.h" #include +#include #ifdef DUMP_FAILURE # include @@ -59,7 +62,7 @@ #define DEFAULT_WINDOW_HALFSIZE 5 typedef struct libmv_RegionTracker { - libmv::TrkltRegionTracker *trklt_region_tracker; + libmv::EsmRegionTracker *klt_region_tracker; libmv::RegionTracker *region_tracker; } libmv_RegionTracker; @@ -112,17 +115,17 @@ void libmv_setLoggingVerbosity(int verbosity) libmv_RegionTracker *libmv_regionTrackerNew(int max_iterations, int pyramid_level) { - libmv::TrkltRegionTracker *trklt_region_tracker = new libmv::TrkltRegionTracker; + libmv::EsmRegionTracker *klt_region_tracker = new libmv::EsmRegionTracker; - trklt_region_tracker->half_window_size = DEFAULT_WINDOW_HALFSIZE; - trklt_region_tracker->max_iterations = max_iterations; - trklt_region_tracker->min_determinant = 1e-4; + klt_region_tracker->half_window_size = DEFAULT_WINDOW_HALFSIZE; + klt_region_tracker->max_iterations = max_iterations; + klt_region_tracker->min_determinant = 1e-4; libmv::PyramidRegionTracker *region_tracker = - new libmv::PyramidRegionTracker(trklt_region_tracker, pyramid_level); + new libmv::PyramidRegionTracker(klt_region_tracker, pyramid_level); libmv_RegionTracker *configured_region_tracker = new libmv_RegionTracker; - configured_region_tracker->trklt_region_tracker = trklt_region_tracker; + configured_region_tracker->klt_region_tracker = klt_region_tracker; configured_region_tracker->region_tracker = region_tracker; return configured_region_tracker; @@ -271,13 +274,13 @@ int libmv_regionTrackerTrack(libmv_RegionTracker *libmv_tracker, const float *im double x1, double y1, double *x2, double *y2) { libmv::RegionTracker *region_tracker; - libmv::TrkltRegionTracker *trklt_region_tracker; + libmv::EsmRegionTracker *klt_region_tracker; libmv::FloatImage old_patch, new_patch; - trklt_region_tracker = libmv_tracker->trklt_region_tracker; + klt_region_tracker = libmv_tracker->klt_region_tracker; region_tracker = libmv_tracker->region_tracker; - trklt_region_tracker->half_window_size = half_window_size; + klt_region_tracker->half_window_size = half_window_size; floatBufToImage(ima1, width, height, &old_patch); floatBufToImage(ima2, width, height, &new_patch); @@ -353,8 +356,24 @@ void libmv_tracksDestroy(libmv_Tracks *libmv_tracks) /* ************ Reconstruction solver ************ */ +int libmv_refineParametersAreValid(int parameters) { + return (parameters == (LIBMV_REFINE_FOCAL_LENGTH)) || + (parameters == (LIBMV_REFINE_FOCAL_LENGTH | + LIBMV_REFINE_PRINCIPAL_POINT)) || + (parameters == (LIBMV_REFINE_FOCAL_LENGTH | + LIBMV_REFINE_PRINCIPAL_POINT | + LIBMV_REFINE_RADIAL_DISTORTION_K1 | + LIBMV_REFINE_RADIAL_DISTORTION_K2)) || + (parameters == (LIBMV_REFINE_FOCAL_LENGTH | + LIBMV_REFINE_RADIAL_DISTORTION_K1 | + LIBMV_REFINE_RADIAL_DISTORTION_K2)) || + (parameters == (LIBMV_REFINE_FOCAL_LENGTH | + LIBMV_REFINE_RADIAL_DISTORTION_K1)); +} + + libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyframe1, int keyframe2, - double focal_length, double principal_x, double principal_y, double k1, double k2, double k3) + int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3) { /* Invert the camera intrinsics. */ libmv::vector markers = ((libmv::Tracks*)tracks)->AllMarkers(); @@ -378,13 +397,34 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra libmv::Tracks normalized_tracks(markers); + // printf("frames to init from: %d, %d\n", keyframe1, keyframe2); libmv::vector keyframe_markers = normalized_tracks.MarkersForTracksInBothImages(keyframe1, keyframe2); + // printf("number of markers for init: %d\n", keyframe_markers.size()); libmv::EuclideanReconstructTwoFrames(keyframe_markers, reconstruction); libmv::EuclideanBundle(normalized_tracks, reconstruction); + libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction); + if (refine_intrinsics) { + /* only a few combinations are supported but trust the caller */ + int libmv_refine_flags = 0; + if (refine_intrinsics & LIBMV_REFINE_FOCAL_LENGTH) { + libmv_refine_flags |= libmv::BUNDLE_FOCAL_LENGTH; + } + if (refine_intrinsics & LIBMV_REFINE_PRINCIPAL_POINT) { + libmv_refine_flags |= libmv::BUNDLE_PRINCIPAL_POINT; + } + if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K1) { + libmv_refine_flags |= libmv::BUNDLE_RADIAL_K1; + } + if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K2) { + libmv_refine_flags |= libmv::BUNDLE_RADIAL_K2; + } + libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags, reconstruction, intrinsics); + } + libmv_reconstruction->tracks = *(libmv::Tracks *)tracks; libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics); @@ -608,6 +648,10 @@ void libmv_destroyFeatures(struct libmv_Features *libmv_features) /* ************ camera intrinsics ************ */ +struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction) { + return (struct libmv_CameraIntrinsics *)&libmv_Reconstruction->intrinsics; +} + struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(double focal_length, double principal_x, double principal_y, double k1, double k2, double k3, int width, int height) { @@ -654,6 +698,16 @@ void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics *libmvIntrinsics intrinsics->SetImageSize(width, height); } +void libmv_CameraIntrinsicsExtract(struct libmv_CameraIntrinsics *libmvIntrinsics, double *focal_length, + double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height) { + libmv::CameraIntrinsics *intrinsics= (libmv::CameraIntrinsics *) libmvIntrinsics; + *focal_length = intrinsics->focal_length(); + *principal_x = intrinsics->principal_point_x(); + *principal_y = intrinsics->principal_point_y(); + *k1 = intrinsics->k1(); + *k2 = intrinsics->k2(); +} + void libmv_CameraIntrinsicsUndistortByte(struct libmv_CameraIntrinsics *libmvIntrinsics, unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) { diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h index b71a66b73a6..d378afc5ea8 100644 --- a/extern/libmv/libmv-capi.h +++ b/extern/libmv/libmv-capi.h @@ -61,8 +61,14 @@ void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks); /* Reconstruction solver */ +#define LIBMV_REFINE_FOCAL_LENGTH (1<<0) +#define LIBMV_REFINE_PRINCIPAL_POINT (1<<1) +#define LIBMV_REFINE_RADIAL_DISTORTION_K1 (1<<2) +#define LIBMV_REFINE_RADIAL_DISTORTION_K2 (1<<4) +int libmv_refineParametersAreValid(int parameters); + struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2, - double focal_length, double principal_x, double principal_y, double k1, double k2, double k3); + int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3); int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]); double libmv_reporojectionErrorForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track); double libmv_reporojectionErrorForImage(struct libmv_Reconstruction *libmv_reconstruction, int image); @@ -80,18 +86,21 @@ void libmv_getFeature(struct libmv_Features *libmv_features, int number, double void libmv_destroyFeatures(struct libmv_Features *libmv_features); /* camera intrinsics */ +struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction); + struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(double focal_length, double principal_x, double principal_y, double k1, double k2, double k3, int width, int height); struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(struct libmv_CameraIntrinsics *libmvIntrinsics); -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(struct libmv_CameraIntrinsics *libmvIntrinsics); - void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmvIntrinsics); void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics *libmvIntrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3, int width, int height); +void libmv_CameraIntrinsicsExtract(struct libmv_CameraIntrinsics *libmvIntrinsics, double *focal_length, + double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height); + void libmv_CameraIntrinsicsUndistortByte(struct libmv_CameraIntrinsics *libmvIntrinsics, unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels); diff --git a/extern/libmv/libmv/simple_pipeline/bundle.cc b/extern/libmv/libmv/simple_pipeline/bundle.cc index cb8822dcf44..d382cd5a4fc 100644 --- a/extern/libmv/libmv/simple_pipeline/bundle.cc +++ b/extern/libmv/libmv/simple_pipeline/bundle.cc @@ -27,6 +27,8 @@ #include "libmv/multiview/fundamental.h" #include "libmv/multiview/projection.h" #include "libmv/numeric/numeric.h" +#include "libmv/simple_pipeline/camera_intrinsics.h" +#include "libmv/simple_pipeline/bundle.h" #include "libmv/simple_pipeline/reconstruction.h" #include "libmv/simple_pipeline/tracks.h" #include "third_party/ssba/Geometry/v3d_cameramatrix.h" @@ -38,6 +40,18 @@ namespace libmv { void EuclideanBundle(const Tracks &tracks, EuclideanReconstruction *reconstruction) { + CameraIntrinsics intrinsics; + EuclideanBundleCommonIntrinsics(tracks, + BUNDLE_NO_INTRINSICS, + reconstruction, + &intrinsics); +} + +void EuclideanBundleCommonIntrinsics(const Tracks &tracks, + int bundle_intrinsics, + EuclideanReconstruction *reconstruction, + CameraIntrinsics *intrinsics) { + LG << "Original intrinsics: " << *intrinsics; vector markers = tracks.AllMarkers(); // "index" in this context is the index that V3D's optimizer will see. The @@ -69,18 +83,20 @@ void EuclideanBundle(const Tracks &tracks, } } - // Make a V3D identity matrix, needed in a few places for K, since this - // assumes a calibrated setup. - V3D::Matrix3x3d identity3x3; - identity3x3[0][0] = 1.0; - identity3x3[0][1] = 0.0; - identity3x3[0][2] = 0.0; - identity3x3[1][0] = 0.0; - identity3x3[1][1] = 1.0; - identity3x3[1][2] = 0.0; - identity3x3[2][0] = 0.0; - identity3x3[2][1] = 0.0; - identity3x3[2][2] = 1.0; + // Convert libmv's K matrix to V3d's K matrix. + V3D::Matrix3x3d v3d_K; + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + v3d_K[i][j] = intrinsics->K()(i, j); + } + } + + // Convert libmv's distortion to v3d distortion. + V3D::StdDistortionFunction v3d_distortion; + v3d_distortion.k1 = intrinsics->k1(); + v3d_distortion.k2 = intrinsics->k2(); + v3d_distortion.p1 = intrinsics->p1(); + v3d_distortion.p2 = intrinsics->p2(); // Convert libmv's cameras to V3D's cameras. std::vector v3d_cameras(index_to_camera.size()); @@ -98,7 +114,7 @@ void EuclideanBundle(const Tracks &tracks, } t[i] = t_libmv(i); } - v3d_cameras[k].setIntrinsic(identity3x3); + v3d_cameras[k].setIntrinsic(v3d_K); v3d_cameras[k].setRotation(R); v3d_cameras[k].setTranslation(t); } @@ -134,27 +150,81 @@ void EuclideanBundle(const Tracks &tracks, } LG << "Number of residuals: " << num_residuals; - // This is calibrated reconstruction, so use zero distortion. - V3D::StdDistortionFunction v3d_distortion; - v3d_distortion.k1 = 0; - v3d_distortion.k2 = 0; - v3d_distortion.p1 = 0; - v3d_distortion.p2 = 0; + // Convert from libmv's specification for which intrinsics to bundle to V3D's. + int v3d_bundle_intrinsics; + if (bundle_intrinsics == BUNDLE_NO_INTRINSICS) { + LG << "Bundling only camera positions."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_METRIC; + } else if (bundle_intrinsics == BUNDLE_FOCAL_LENGTH) { + LG << "Bundling f."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_FOCAL_LENGTH; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_PRINCIPAL_POINT)) { + LG << "Bundling f, px, py."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_FOCAL_LENGTH_PP; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_PRINCIPAL_POINT | + BUNDLE_RADIAL)) { + LG << "Bundling f, px, py, k1, k2."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_RADIAL; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_PRINCIPAL_POINT | + BUNDLE_RADIAL | + BUNDLE_TANGENTIAL)) { + LG << "Bundling f, px, py, k1, k2, p1, p2."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_RADIAL_TANGENTIAL; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_RADIAL | + BUNDLE_TANGENTIAL)) { + LG << "Bundling f, px, py, k1, k2, p1, p2."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_RADIAL_TANGENTIAL; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_RADIAL)) { + LG << "Bundling f, k1, k2."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_FOCAL_AND_RADIAL; + } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | + BUNDLE_RADIAL_K1)) { + LG << "Bundling f, k1."; + v3d_bundle_intrinsics = V3D::FULL_BUNDLE_FOCAL_AND_RADIAL_K1; + } else { + LOG(FATAL) << "Unsupported bundle combination."; + } + + // Ignore any outliers; assume supervised tracking. + double v3d_inlier_threshold = 500000.0; // Finally, run the bundle adjustment. - double const inlierThreshold = 500000.0; - V3D::CommonInternalsMetricBundleOptimizer opt(V3D::FULL_BUNDLE_METRIC, - inlierThreshold, - identity3x3, + V3D::CommonInternalsMetricBundleOptimizer opt(v3d_bundle_intrinsics, + v3d_inlier_threshold, + v3d_K, v3d_distortion, v3d_cameras, v3d_points, v3d_measurements, v3d_camera_for_measurement, v3d_point_for_measurement); - opt.maxIterations = 50; + opt.maxIterations = 500; opt.minimize(); - LG << "Bundle status: " << opt.status; + if (opt.status == V3D::LEVENBERG_OPTIMIZER_TIMEOUT) { + LG << "Bundle status: Timed out."; + } else if (opt.status == V3D::LEVENBERG_OPTIMIZER_SMALL_UPDATE) { + LG << "Bundle status: Small update."; + } else if (opt.status == V3D::LEVENBERG_OPTIMIZER_CONVERGED) { + LG << "Bundle status: Converged."; + } + + // Convert V3D's K matrix back to libmv's K matrix. + Mat3 K; + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + K(i, j) = v3d_K[i][j]; + } + } + intrinsics->SetK(K); + + // Convert V3D's distortion back to libmv's distortion. + intrinsics->SetRadialDistortion(v3d_distortion.k1, v3d_distortion.k2, 0.0); + intrinsics->SetTangentialDistortion(v3d_distortion.p1, v3d_distortion.p2); // Convert V3D's cameras back to libmv's cameras. for (int k = 0; k < num_cameras; k++) { @@ -173,6 +243,7 @@ void EuclideanBundle(const Tracks &tracks, index_to_point[k]->X(i) = v3d_points[k][i]; } } + LG << "Final intrinsics: " << *intrinsics; } void ProjectiveBundle(const Tracks & /*tracks*/, diff --git a/extern/libmv/libmv/simple_pipeline/bundle.h b/extern/libmv/libmv/simple_pipeline/bundle.h index c7fb2a79607..55657cb2d92 100644 --- a/extern/libmv/libmv/simple_pipeline/bundle.h +++ b/extern/libmv/libmv/simple_pipeline/bundle.h @@ -23,6 +23,7 @@ namespace libmv { +class CameraIntrinsics; class EuclideanReconstruction; class ProjectiveReconstruction; class Tracks; @@ -47,6 +48,46 @@ class Tracks; void EuclideanBundle(const Tracks &tracks, EuclideanReconstruction *reconstruction); +/*! + Refine camera poses and 3D coordinates using bundle adjustment. + + This routine adjusts all cameras positions, points, and the camera + intrinsics (assumed common across all images) in \a *reconstruction. This + assumes a full observation for reconstructed tracks; this implies that if + there is a reconstructed 3D point (a bundle) for a track, then all markers + for that track will be included in the minimization. \a tracks should + contain markers used in the initial reconstruction. + + The cameras, bundles, and intrinsics are refined in-place. + + The only supported combinations of bundle parameters are: + + BUNDLE_NO_INTRINSICS + BUNDLE_FOCAL_LENGTH + BUNDLE_FOCAL_LENGTH | BUNDLE_PRINCIPAL_POINT + BUNDLE_FOCAL_LENGTH | BUNDLE_PRINCIPAL_POINT | BUNDLE_RADIAL + BUNDLE_FOCAL_LENGTH | BUNDLE_PRINCIPAL_POINT | BUNDLE_RADIAL | BUNDLE_TANGENTIAL + + \note This assumes an outlier-free set of markers. + + \sa EuclideanResect, EuclideanIntersect, EuclideanReconstructTwoFrames +*/ +enum BundleIntrinsics { + BUNDLE_NO_INTRINSICS = 0, + BUNDLE_FOCAL_LENGTH = 1, + BUNDLE_PRINCIPAL_POINT = 2, + BUNDLE_RADIAL_K1 = 4, + BUNDLE_RADIAL_K2 = 8, + BUNDLE_RADIAL = 12, + BUNDLE_TANGENTIAL_P1 = 16, + BUNDLE_TANGENTIAL_P2 = 32, + BUNDLE_TANGENTIAL = 48, +}; +void EuclideanBundleCommonIntrinsics(const Tracks &tracks, + int bundle_intrinsics, + EuclideanReconstruction *reconstruction, + CameraIntrinsics *intrinsics); + /*! Refine camera poses and 3D coordinates using bundle adjustment. diff --git a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc index 366129dd3d2..917f80e6926 100644 --- a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc +++ b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc @@ -348,4 +348,26 @@ void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, i //else assert("channels must be between 1 and 4"); } +std::ostream& operator <<(std::ostream &os, + const CameraIntrinsics &intrinsics) { + if (intrinsics.focal_length_x() == intrinsics.focal_length_x()) { + os << "f=" << intrinsics.focal_length(); + } else { + os << "fx=" << intrinsics.focal_length_x() + << " fy=" << intrinsics.focal_length_y(); + } + os << " cx=" << intrinsics.principal_point_x() + << " cy=" << intrinsics.principal_point_y() + << " w=" << intrinsics.image_width() + << " h=" << intrinsics.image_height(); + + if (intrinsics.k1() != 0.0) { os << " k1=" << intrinsics.k1(); } + if (intrinsics.k2() != 0.0) { os << " k2=" << intrinsics.k2(); } + if (intrinsics.k3() != 0.0) { os << " k3=" << intrinsics.k3(); } + if (intrinsics.p1() != 0.0) { os << " p1=" << intrinsics.p1(); } + if (intrinsics.p2() != 0.0) { os << " p2=" << intrinsics.p2(); } + + return os; +} + } // namespace libmv diff --git a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.h b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.h index f4bf903c36c..e0556674ad5 100644 --- a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.h +++ b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.h @@ -21,11 +21,15 @@ #ifndef LIBMV_SIMPLE_PIPELINE_CAMERA_INTRINSICS_H_ #define LIBMV_SIMPLE_PIPELINE_CAMERA_INTRINSICS_H_ +#include +#include + #include -typedef Eigen::Matrix Mat3; namespace libmv { +typedef Eigen::Matrix Mat3; + struct Grid; class CameraIntrinsics { @@ -35,7 +39,6 @@ class CameraIntrinsics { ~CameraIntrinsics(); const Mat3 &K() const { return K_; } - // FIXME(MatthiasF): these should be CamelCase methods double focal_length() const { return K_(0, 0); } double focal_length_x() const { return K_(0, 0); } double focal_length_y() const { return K_(1, 1); } @@ -55,8 +58,10 @@ class CameraIntrinsics { /// Set both x and y focal length in pixels. void SetFocalLength(double focal_x, double focal_y); + /// Set principal point in pixels. void SetPrincipalPoint(double cx, double cy); + /// Set the image size in pixels. void SetImageSize(int width, int height); void SetRadialDistortion(double k1, double k2, double k3 = 0); @@ -92,6 +97,7 @@ class CameraIntrinsics { */ void Distort(const float* src, float* dst, int width, int height, double overscan, int channels); + /*! Distort an image using the current camera instrinsics @@ -102,6 +108,7 @@ class CameraIntrinsics { */ void Distort(const unsigned char* src, unsigned char* dst, int width, int height, double overscan, int channels); + /*! Undistort an image using the current camera instrinsics @@ -112,6 +119,7 @@ class CameraIntrinsics { */ void Undistort(const float* src, float* dst, int width, int height, double overscan, int channels); + /*! Undistort an image using the current camera instrinsics @@ -147,6 +155,10 @@ class CameraIntrinsics { struct Grid *undistort_; }; +/// A human-readable representation of the camera intrinsic parameters. +std::ostream& operator <<(std::ostream &os, + const CameraIntrinsics &intrinsics); + } // namespace libmv #endif // LIBMV_SIMPLE_PIPELINE_CAMERA_INTRINSICS_H_ diff --git a/extern/libmv/libmv/simple_pipeline/initialize_reconstruction.cc b/extern/libmv/libmv/simple_pipeline/initialize_reconstruction.cc index 0597f09f728..77fe2a530c4 100644 --- a/extern/libmv/libmv/simple_pipeline/initialize_reconstruction.cc +++ b/extern/libmv/libmv/simple_pipeline/initialize_reconstruction.cc @@ -67,6 +67,7 @@ void GetImagesInMarkers(const vector &markers, bool EuclideanReconstructTwoFrames(const vector &markers, EuclideanReconstruction *reconstruction) { if (markers.size() < 16) { + LG << "Not enough markers to initialize from two frames: " << markers.size(); return false; } @@ -105,6 +106,7 @@ bool EuclideanReconstructTwoFrames(const vector &markers, K, x1.col(0), K, x2.col(0), &R, &t)) { + LG << "Failed to compute R and t from E and K."; return false; } diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.cc b/extern/libmv/libmv/simple_pipeline/pipeline.cc index 818c24cb5e7..9512a41c00f 100644 --- a/extern/libmv/libmv/simple_pipeline/pipeline.cc +++ b/extern/libmv/libmv/simple_pipeline/pipeline.cc @@ -262,7 +262,6 @@ double InternalReprojectionError(const Tracks &image_tracks, ex, ey, sqrt(ex*ex + ey*ey)); - //LG << line; total_error += sqrt(ex*ex + ey*ey); } LG << "Skipped " << num_skipped << " markers."; diff --git a/extern/libmv/libmv/tracking/esm_region_tracker.cc b/extern/libmv/libmv/tracking/esm_region_tracker.cc new file mode 100644 index 00000000000..2e5c255e153 --- /dev/null +++ b/extern/libmv/libmv/tracking/esm_region_tracker.cc @@ -0,0 +1,288 @@ +// Copyright (c) 2007, 2008, 2009, 2011 libmv authors. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#include "libmv/tracking/esm_region_tracker.h" + +#include "libmv/logging/logging.h" +#include "libmv/image/image.h" +#include "libmv/image/convolve.h" +#include "libmv/image/sample.h" +#include "libmv/numeric/numeric.h" + +namespace libmv { + +// TODO(keir): Reduce duplication between here and the other region trackers. +bool RegionIsInBounds(const FloatImage &image1, + double x, double y, + int half_window_size) { + // Check the minimum coordinates. + int min_x = floor(x) - half_window_size - 1; + int min_y = floor(y) - half_window_size - 1; + if (min_x < 0.0 || + min_y < 0.0) { + return false; + } + + // Check the maximum coordinates. + int max_x = ceil(x) + half_window_size + 1; + int max_y = ceil(y) + half_window_size + 1; + if (max_x > image1.cols() || + max_y > image1.rows()) { + return false; + } + + // Ok, we're good. + return true; +} + +// Sample a region centered at x,y in image with size extending by half_width +// from x,y. Channels specifies the number of channels to sample from. +void SamplePattern(const FloatImage &image, + double x, double y, + int half_width, + int channels, + FloatImage *sampled) { + sampled->Resize(2 * half_width + 1, 2 * half_width + 1, channels); + for (int r = -half_width; r <= half_width; ++r) { + for (int c = -half_width; c <= half_width; ++c) { + for (int i = 0; i < channels; ++i) { + (*sampled)(r + half_width, c + half_width, i) = + SampleLinear(image, y + r, x + c, i); + } + } + } +} + +// Estimate "reasonable" error by computing autocorrelation for a small shift. +// TODO(keir): Add a facility for +double EstimateReasonableError(const FloatImage &image, + double x, double y, + int half_width) { + double error = 0.0; + for (int r = -half_width; r <= half_width; ++r) { + for (int c = -half_width; c <= half_width; ++c) { + double s = SampleLinear(image, y + r, x + c, 0); + double e1 = SampleLinear(image, y + r + 0.5, x + c, 0) - s; + double e2 = SampleLinear(image, y + r, x + c + 0.5, 0) - s; + error += e1*e1 + e2*e2; + } + } + // XXX hack + return error / 2.0 * 16.0; +} + +// This is implemented from "Lukas and Kanade 20 years on: Part 1. Page 42, +// figure 14: the Levenberg-Marquardt-Inverse Compositional Algorithm". +bool EsmRegionTracker::Track(const FloatImage &image1, + const FloatImage &image2, + double x1, double y1, + double *x2, double *y2) const { + if (!RegionIsInBounds(image1, x1, y1, half_window_size)) { + LG << "Fell out of image1's window with x1=" << x1 << ", y1=" << y1 + << ", hw=" << half_window_size << "."; + return false; + } + + int width = 2 * half_window_size + 1; + + // TODO(keir): Avoid recomputing gradients for e.g. the pyramid tracker. + Array3Df image_and_gradient1; + Array3Df image_and_gradient2; + BlurredImageAndDerivativesChannels(image1, sigma, &image_and_gradient1); + BlurredImageAndDerivativesChannels(image2, sigma, &image_and_gradient2); + + // Step -1: Resample the template (image1) since it is not pixel aligned. + // + // Take a sample of the gradient of the pattern area of image1 at the + // subpixel position x1, x2. This is reused for each iteration, so + // precomputing it saves time. + Array3Df image_and_gradient1_sampled; + SamplePattern(image_and_gradient1, x1, y1, half_window_size, 3, + &image_and_gradient1_sampled); + + // Step 0: Initialize delta = 0.01. + // + // Ignored for my "normal" LM loop. + + double reasonable_error = + EstimateReasonableError(image1, x1, y1, half_window_size); + + // Step 1: Warp I with W(x, p) to compute I(W(x; p). + // + // Use two images for accepting / rejecting updates. + // XXX is this necessary? + int current_image = 0, new_image = 1; + Array3Df image_and_gradient2_sampled[2]; + SamplePattern(image_and_gradient2, *x2, *y2, half_window_size, 3, + &image_and_gradient2_sampled[current_image]); + + // Step 2: Compute the squared error I - J. + double error = 0; + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image_and_gradient1_sampled(r, c, 0) - + image_and_gradient2_sampled[current_image](r, c, 0); + error += e*e; + } + } + + // Step 3: Evaluate the gradient of the template. + // + // This is done above when sampling the template (step -1). + + // Step 4: Evaluate the jacobian dw/dp at (x; 0). + // + // The jacobian between dx,dy and the warp is constant 2x2 identity, so it + // doesn't have to get computed. The Gauss-Newton Hessian matrix computation + // below would normally have to include a multiply by the jacobian. + + // Step 5: Compute the steepest descent images of the template. + // + // Since the jacobian of the position w.r.t. the sampled template position is + // the identity, the steepest descent images are the same as the gradient. + + // Step 6: Compute the Gauss-Newton Hessian for the template (image1). + // + // This could get rolled into the previous loop, but split it for now for + // clarity. + Mat2 H_image1 = Mat2::Zero(); + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + Vec2 g(image_and_gradient1_sampled(r, c, 1), + image_and_gradient1_sampled(r, c, 2)); + H_image1 += g * g.transpose(); + } + } + + double tau = 1e-4, eps1, eps2, eps3; + eps1 = eps2 = eps3 = 1e-15; + + double mu = tau * std::max(H_image1(0, 0), H_image1(1, 1)); + double nu = M_E; + + int i; + for (i = 0; i < max_iterations; ++i) { + // Check that the entire image patch is within the bounds of the images. + if (!RegionIsInBounds(image2, *x2, *y2, half_window_size)) { + LG << "Fell out of image2's window with x2=" << *x2 << ", y2=" << *y2 + << ", hw=" << half_window_size << "."; + return false; + } + + Mat2 H = Mat2::Zero(); + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + Vec2 g1(image_and_gradient1_sampled(r, c, 1), + image_and_gradient1_sampled(r, c, 2)); + Vec2 g2(image_and_gradient2_sampled[current_image](r, c, 1), + image_and_gradient2_sampled[current_image](r, c, 2)); + Vec2 g = g1 + g2; // Should be / 2.0, but do that outside the loop. + H += g * g.transpose(); + } + } + H /= 4.0; + + // Step 7: Compute z + Vec2 z = Vec2::Zero(); + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image_and_gradient2_sampled[current_image](r, c, 0) - + image_and_gradient1_sampled(r, c, 0); + z(0) += image_and_gradient1_sampled(r, c, 1) * e; + z(1) += image_and_gradient1_sampled(r, c, 2) * e; + z(0) += image_and_gradient2_sampled[current_image](r, c, 1) * e; + z(1) += image_and_gradient2_sampled[current_image](r, c, 2) * e; + } + } + z /= 2.0; + + // Step 8: Compute Hlm and (dx,dy) + Mat2 diag = H.diagonal().asDiagonal(); + diag *= mu; + Mat2 Hlm = H + diag; + Vec2 d = Hlm.lu().solve(z); + + // TODO(keir): Use the usual LM termination and update criterion instead of + // this hacky version from the LK 20 years on paper. + LG << "x=" << *x2 << ", y=" << *y2 << ", dx=" << d[0] << ", dy=" << d[1] + << ", mu=" << mu << ", nu=" << nu; + + // Step 9: Update the warp; W(x; p) <-- W(x;p) compose W(x, dp)^-1 + double new_x2 = *x2 - d[0]; + double new_y2 = *y2 - d[1]; + + // Step 9.1: Sample the image at the new position. + SamplePattern(image_and_gradient2, new_x2, new_y2, half_window_size, 3, + &image_and_gradient2_sampled[new_image]); + + // Step 9.2: Compute the new error. + // TODO(keir): Eliminate duplication with above code. + double new_error = 0; + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image_and_gradient1_sampled(r, c, 0) - + image_and_gradient2_sampled[new_image](r, c, 0); + new_error += e*e; + } + } + //LG << "Old error: " << error << ", new error: " << new_error; + + double rho = (error - new_error) / (d.transpose() * (mu * d + z)); + + // Step 10: Accept or reject step. + if (rho <= 0) { + // This was a bad step, so don't update. + mu *= nu; + + // The standard Levenberg-Marquardt update multiplies nu by 2, but + // instead chose e. I chose a constant greater than 2 since in typical + // tracking examples, I saw that once updates started failing they should + // ramp towards steepest descent faster. This has no basis in theory, but + // appears to lead to faster tracking overall. + nu *= M_E; + LG << "Error increased, so reject update."; + } else { + // The step was good, so update. + *x2 = new_x2; + *y2 = new_y2; + std::swap(new_image, current_image); + error = new_error; + + mu *= std::max(1/3., 1 - pow(2*rho - 1, 3)); + nu = M_E; // See above for why to use e. + } + + // If the step was accepted, then check for termination. + if (d.squaredNorm() < min_update_squared_distance) { + if (new_error > reasonable_error) { + LG << "Update size shrank but reasonable error (" + << reasonable_error << ") not achieved; failing."; + return true; // XXX + } + LG << "Successful track in " << (i + 1) << " iterations."; + return true; + } + } + // Getting here means we hit max iterations, so tracking failed. + LG << "Too many iterations; max is set to " << max_iterations << "."; + return false; +} + +} // namespace libmv diff --git a/extern/libmv/libmv/tracking/esm_region_tracker.h b/extern/libmv/libmv/tracking/esm_region_tracker.h new file mode 100644 index 00000000000..c63417201ad --- /dev/null +++ b/extern/libmv/libmv/tracking/esm_region_tracker.h @@ -0,0 +1,61 @@ +// Copyright (c) 2007, 2008, 2009, 2011 libmv authors. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#ifndef LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ +#define LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ + +#include "libmv/image/image.h" +#include "libmv/tracking/region_tracker.h" + +namespace libmv { + +/*! + A translation-only Efficient Second-order Minimization ("ESM") tracker + + Based on the paper "Real-time image-based trackiing of planes using + Efficient Second-order Minimization" +*/ +struct EsmRegionTracker : public RegionTracker { + EsmRegionTracker() + : half_window_size(4), + max_iterations(16), + min_determinant(1e-6), + min_update_squared_distance(1e-4), + sigma(0.9) {} + + virtual ~EsmRegionTracker() {} + + // Tracker interface. + virtual bool Track(const FloatImage &image1, + const FloatImage &image2, + double x1, double y1, + double *x2, double *y2) const; + + // No point in creating getters or setters. + int half_window_size; + int max_iterations; + double min_determinant; + double min_update_squared_distance; + double sigma; +}; + +} // namespace libmv + +#endif // LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ diff --git a/extern/libmv/libmv/tracking/klt_region_tracker.cc b/extern/libmv/libmv/tracking/klt_region_tracker.cc index 299077be155..78ce0be603c 100644 --- a/extern/libmv/libmv/tracking/klt_region_tracker.cc +++ b/extern/libmv/libmv/tracking/klt_region_tracker.cc @@ -63,24 +63,26 @@ static void ComputeTrackingEquation(const Array3Df &image_and_gradient1, } } -// Solve the tracking equation -// -// [gxx gxy] [dx] = [ex] -// [gxy gyy] [dy] = [ey] -// -// for dx and dy. Borrowed from Stan Birchfield's KLT implementation. -static bool SolveTrackingEquation(float gxx, float gxy, float gyy, - float ex, float ey, - float min_determinant, - float *dx, float *dy) { - float det = gxx * gyy - gxy * gxy; - if (det < min_determinant) { - *dx = 0; - *dy = 0; +bool RegionIsInBounds(const FloatImage &image1, + double x, double y, + int half_window_size) { + // Check the minimum coordinates. + int min_x = floor(x) - half_window_size - 1; + int min_y = floor(y) - half_window_size - 1; + if (min_x < 0.0 || + min_y < 0.0) { return false; } - *dx = (gyy * ex - gxy * ey) / det; - *dy = (gxx * ey - gxy * ex) / det; + + // Check the maximum coordinates. + int max_x = ceil(x) + half_window_size + 1; + int max_y = ceil(y) + half_window_size + 1; + if (max_x > image1.cols() || + max_y > image1.rows()) { + return false; + } + + // Ok, we're good. return true; } @@ -88,6 +90,12 @@ bool KltRegionTracker::Track(const FloatImage &image1, const FloatImage &image2, double x1, double y1, double *x2, double *y2) const { + if (!RegionIsInBounds(image1, x1, y1, half_window_size)) { + LG << "Fell out of image1's window with x1=" << x1 << ", y1=" << y1 + << ", hw=" << half_window_size << "."; + return false; + } + Array3Df image_and_gradient1; Array3Df image_and_gradient2; BlurredImageAndDerivativesChannels(image1, sigma, &image_and_gradient1); @@ -96,6 +104,13 @@ bool KltRegionTracker::Track(const FloatImage &image1, int i; float dx = 0, dy = 0; for (i = 0; i < max_iterations; ++i) { + // Check that the entire image patch is within the bounds of the images. + if (!RegionIsInBounds(image2, *x2, *y2, half_window_size)) { + LG << "Fell out of image2's window with x2=" << *x2 << ", y2=" << *y2 + << ", hw=" << half_window_size << "."; + return false; + } + // Compute gradient matrix and error vector. float gxx, gxy, gyy, ex, ey; ComputeTrackingEquation(image_and_gradient1, @@ -105,19 +120,32 @@ bool KltRegionTracker::Track(const FloatImage &image1, half_window_size, &gxx, &gxy, &gyy, &ex, &ey); - // Solve the linear system for the best update to x2 and y2. - if (!SolveTrackingEquation(gxx, gxy, gyy, ex, ey, min_determinant, - &dx, &dy)) { - // The determinant, which indicates the trackiness of the point, is too - // small, so fail out. - LG << "Determinant too small; failing tracking."; - return false; - } + // Solve the tracking equation + // + // [gxx gxy] [dx] = [ex] + // [gxy gyy] [dy] = [ey] + // + // for dx and dy. Borrowed from Stan Birchfield's KLT implementation. + float determinant = gxx * gyy - gxy * gxy; + dx = (gyy * ex - gxy * ey) / determinant; + dy = (gxx * ey - gxy * ex) / determinant; // Update the position with the solved displacement. *x2 += dx; *y2 += dy; + // Check for the quality of the solution, but not until having already + // updated the position with our best estimate. The reason to do the update + // anyway is that the user already knows the position is bad, so we may as + // well try our best. + if (determinant < min_determinant) { + // The determinant, which indicates the trackiness of the point, is too + // small, so fail out. + LG << "Determinant " << determinant << " is too small; failing tracking."; + return false; + } + LG << "x=" << *x2 << ", y=" << *y2 << ", dx=" << dx << ", dy=" << dy << ", det=" << determinant; + // If the update is small, then we probably found the target. if (dx * dx + dy * dy < min_update_squared_distance) { LG << "Successful track in " << i << " iterations."; @@ -125,7 +153,7 @@ bool KltRegionTracker::Track(const FloatImage &image1, } } // Getting here means we hit max iterations, so tracking failed. - LG << "Too many iterations."; + LG << "Too many iterations; max is set to " << max_iterations << "."; return false; } diff --git a/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc b/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc new file mode 100644 index 00000000000..5ac96e66175 --- /dev/null +++ b/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc @@ -0,0 +1,265 @@ +// Copyright (c) 2007, 2008, 2009, 2011 libmv authors. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#include "libmv/tracking/lmicklt_region_tracker.h" + +#include "libmv/logging/logging.h" +#include "libmv/image/image.h" +#include "libmv/image/convolve.h" +#include "libmv/image/sample.h" +#include "libmv/numeric/numeric.h" + +namespace libmv { + +// TODO(keir): Reduce duplication between here and the other region trackers. +bool RegionIsInBounds(const FloatImage &image1, + double x, double y, + int half_window_size) { + // Check the minimum coordinates. + int min_x = floor(x) - half_window_size - 1; + int min_y = floor(y) - half_window_size - 1; + if (min_x < 0.0 || + min_y < 0.0) { + return false; + } + + // Check the maximum coordinates. + int max_x = ceil(x) + half_window_size + 1; + int max_y = ceil(y) + half_window_size + 1; + if (max_x > image1.cols() || + max_y > image1.rows()) { + return false; + } + + // Ok, we're good. + return true; +} + +// Sample a region centered at x,y in image with size extending by half_width +// from x,y. Channels specifies the number of channels to sample from. +void SamplePattern(const FloatImage &image, + double x, double y, + int half_width, + int channels, + FloatImage *sampled) { + sampled->Resize(2 * half_width + 1, 2 * half_width + 1, channels); + for (int r = -half_width; r <= half_width; ++r) { + for (int c = -half_width; c <= half_width; ++c) { + for (int i = 0; i < channels; ++i) { + (*sampled)(r + half_width, c + half_width, i) = + SampleLinear(image, y + r, x + c, i); + } + } + } +} + +// Estimate "reasonable" error by computing autocorrelation for a small shift. +double EstimateReasonableError(const FloatImage &image, + double x, double y, + int half_width) { + double error = 0.0; + for (int r = -half_width; r <= half_width; ++r) { + for (int c = -half_width; c <= half_width; ++c) { + double s = SampleLinear(image, y + r, x + c, 0); + double e1 = SampleLinear(image, y + r + 0.5, x + c, 0) - s; + double e2 = SampleLinear(image, y + r, x + c + 0.5, 0) - s; + error += e1*e1 + e2*e2; + } + } + return error / 2.0 * 8.0; +} + +// This is implemented from "Lukas and Kanade 20 years on: Part 1. Page 42, +// figure 14: the Levenberg-Marquardt-Inverse Compositional Algorithm". +bool LmickltRegionTracker::Track(const FloatImage &image1, + const FloatImage &image2, + double x1, double y1, + double *x2, double *y2) const { + if (!RegionIsInBounds(image1, x1, y1, half_window_size)) { + LG << "Fell out of image1's window with x1=" << x1 << ", y1=" << y1 + << ", hw=" << half_window_size << "."; + return false; + } + + int width = 2 * half_window_size + 1; + + // TODO(keir): Avoid recomputing gradients for e.g. the pyramid tracker. + Array3Df image_and_gradient1; + Array3Df image_and_gradient2; + BlurredImageAndDerivativesChannels(image1, sigma, &image_and_gradient1); + + // TODO(keir): Avoid computing the derivative of image2. + BlurredImageAndDerivativesChannels(image2, sigma, &image_and_gradient2); + + // Step -1: Resample the template (image1) since it is not pixel aligned. + // + // Take a sample of the gradient of the pattern area of image1 at the + // subpixel position x1, x2. This is reused for each iteration, so + // precomputing it saves time. + Array3Df image_and_gradient1_sampled; + SamplePattern(image_and_gradient1, x1, y1, half_window_size, 3, + &image_and_gradient1_sampled); + + // Step 0: Initialize delta = 0.01. + // + // Ignored for my "normal" LM loop. + + double reasonable_error = + EstimateReasonableError(image1, x1, y1, half_window_size); + + // Step 1: Warp I with W(x, p) to compute I(W(x; p). + // + // Use two images for accepting / rejecting updates. + int current_image = 0, new_image = 1; + Array3Df image2_sampled[2]; + SamplePattern(image_and_gradient2, *x2, *y2, half_window_size, 1, + &image2_sampled[current_image]); + + // Step 2: Compute the squared error I - J. + double error = 0; + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image_and_gradient1_sampled(r, c, 0) - + image2_sampled[current_image](r, c, 0); + error += e*e; + } + } + + // Step 3: Evaluate the gradient of the template. + // + // This is done above when sampling the template (step -1). + + // Step 4: Evaluate the jacobian dw/dp at (x; 0). + // + // The jacobian between dx,dy and the warp is constant 2x2 identity, so it + // doesn't have to get computed. The Gauss-Newton Hessian matrix computation + // below would normally have to include a multiply by the jacobian. + + // Step 5: Compute the steepest descent images of the template. + // + // Since the jacobian of the position w.r.t. the sampled template position is + // the identity, the steepest descent images are the same as the gradient. + + // Step 6: Compute the Gauss-Newton Hessian for the template (image1). + // + // This could get rolled into the previous loop, but split it for now for + // clarity. + Mat2 H = Mat2::Zero(); + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + Vec2 g(image_and_gradient1_sampled(r, c, 1), + image_and_gradient1_sampled(r, c, 2)); + H += g * g.transpose(); + } + } + + double tau = 1e-3, eps1, eps2, eps3; + eps1 = eps2 = eps3 = 1e-15; + + double mu = tau * std::max(H(0, 0), H(1, 1)); + double nu = 2.0; + + int i; + for (i = 0; i < max_iterations; ++i) { + // Check that the entire image patch is within the bounds of the images. + if (!RegionIsInBounds(image2, *x2, *y2, half_window_size)) { + LG << "Fell out of image2's window with x2=" << *x2 << ", y2=" << *y2 + << ", hw=" << half_window_size << "."; + return false; + } + + // Step 7: Compute z + Vec2 z = Vec2::Zero(); + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image2_sampled[current_image](r, c, 0) - + image_and_gradient1_sampled(r, c, 0); + z(0) += image_and_gradient1_sampled(r, c, 1) * e; + z(1) += image_and_gradient1_sampled(r, c, 2) * e; + } + } + + // Step 8: Compute Hlm and (dx,dy) + Mat2 diag = H.diagonal().asDiagonal(); + diag *= mu; + Mat2 Hlm = H + diag; + Vec2 d = Hlm.lu().solve(z); + + // TODO(keir): Use the usual LM termination and update criterion instead of + // this hacky version from the LK 20 years on paper. + LG << "x=" << *x2 << ", y=" << *y2 << ", dx=" << d[0] << ", dy=" << d[1] + << ", mu=" << mu << ", nu=" << nu; + + // Step 9: Update the warp; W(x; p) <-- W(x;p) compose W(x, dp)^-1 + double new_x2 = *x2 - d[0]; + double new_y2 = *y2 - d[1]; + + // Step 9.1: Sample the image at the new position. + SamplePattern(image_and_gradient2, new_x2, new_y2, half_window_size, 1, + &image2_sampled[new_image]); + + // Step 9.2: Compute the new error. + // TODO(keir): Eliminate duplication with above code. + double new_error = 0; + for (int r = 0; r < width; ++r) { + for (int c = 0; c < width; ++c) { + double e = image_and_gradient1_sampled(r, c, 0) - + image2_sampled[new_image](r, c, 0); + new_error += e*e; + } + } + LG << "Old error: " << error << ", new error: " << new_error; + + // If the step was accepted, then check for termination. + if (d.squaredNorm() < min_update_squared_distance) { + if (new_error > reasonable_error) { + LG << "Update size shrank but reasonable error (" + << reasonable_error << ") not achieved; failing."; + return false; + } + LG << "Successful track in " << i << " iterations."; + return true; + } + + double rho = (error - new_error) / (d.transpose() * (mu * d + z)); + + // Step 10: Accept or reject step. + if (rho <= 0) { + // This was a bad step, so don't update. + mu *= nu; + nu *= 2; + LG << "Error increased, so reject update."; + } else { + // The step was good, so update. + *x2 = new_x2; + *y2 = new_y2; + std::swap(new_image, current_image); + error = new_error; + + mu *= std::max(1/3., 1 - pow(2*rho - 1, 3)); + nu = 2; + } + } + // Getting here means we hit max iterations, so tracking failed. + LG << "Too many iterations; max is set to " << max_iterations << "."; + return false; +} + +} // namespace libmv diff --git a/extern/libmv/libmv/tracking/lmicklt_region_tracker.h b/extern/libmv/libmv/tracking/lmicklt_region_tracker.h new file mode 100644 index 00000000000..744f2dfe277 --- /dev/null +++ b/extern/libmv/libmv/tracking/lmicklt_region_tracker.h @@ -0,0 +1,62 @@ +// Copyright (c) 2007, 2008, 2009, 2011 libmv authors. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#ifndef LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ +#define LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ + +#include "libmv/image/image.h" +#include "libmv/tracking/region_tracker.h" + +namespace libmv { + +/*! + Levenberg-Marquardt inverse compositional region tracking + + This tracker implements the Levenberg-Marquardt inverse compositional + region tracking algorithm as described in the paper "Lucas and Kanade 20 + years on: A unifying framework." +*/ +struct LmickltRegionTracker : public RegionTracker { + LmickltRegionTracker() + : half_window_size(4), + max_iterations(16), + min_determinant(1e-6), + min_update_squared_distance(1e-6), + sigma(0.9) {} + + virtual ~LmickltRegionTracker() {} + + // Tracker interface. + virtual bool Track(const FloatImage &image1, + const FloatImage &image2, + double x1, double y1, + double *x2, double *y2) const; + + // No point in creating getters or setters. + int half_window_size; + int max_iterations; + double min_determinant; + double min_update_squared_distance; + double sigma; +}; + +} // namespace libmv + +#endif // LIBMV_REGION_TRACKING_LMICKLT_REGION_TRACKER_H_ diff --git a/extern/libmv/libmv/tracking/pyramid_region_tracker.cc b/extern/libmv/libmv/tracking/pyramid_region_tracker.cc index 58f42b26d7c..c177f9c5a83 100644 --- a/extern/libmv/libmv/tracking/pyramid_region_tracker.cc +++ b/extern/libmv/libmv/tracking/pyramid_region_tracker.cc @@ -63,15 +63,32 @@ bool PyramidRegionTracker::Track(const FloatImage &image1, *x2 *= 2; *y2 *= 2; - // Track the point on this level with the base tracker. - bool succeeded = tracker_->Track(pyramid1[i], pyramid2[i], xx, yy, x2, y2); + // Save the previous best guess for this level, since tracking within this + // level might fail. + double x2_new = *x2; + double y2_new = *y2; - if (i == 0 && !succeeded) { - // Only fail on the highest-resolution level, because a failure on a - // coarse level does not mean failure at a lower level (consider - // out-of-bounds conditions). - LG << "Finest level of pyramid tracking failed; failing."; - return false; + // Track the point on this level with the base tracker. + LG << "Tracking on level " << i; + bool succeeded = tracker_->Track(pyramid1[i], pyramid2[i], xx, yy, + &x2_new, &y2_new); + + if (!succeeded) { + if (i == 0) { + // Only fail on the highest-resolution level, because a failure on a + // coarse level does not mean failure at a lower level (consider + // out-of-bounds conditions). + LG << "Finest level of pyramid tracking failed; failing."; + return false; + } + + LG << "Failed to track at level " << i << "; restoring guess."; + } else { + // Only save the update if the track for this level succeeded. This is a + // bit of a hack; the jury remains out on whether this is better than + // re-using the previous failed-attempt. + *x2 = x2_new; + *y2 = y2_new; } } return true; diff --git a/extern/libmv/libmv/tracking/trklt_region_tracker.cc b/extern/libmv/libmv/tracking/trklt_region_tracker.cc index 94319fcb7d3..7e51787ebac 100644 --- a/extern/libmv/libmv/tracking/trklt_region_tracker.cc +++ b/extern/libmv/libmv/tracking/trklt_region_tracker.cc @@ -28,6 +28,8 @@ namespace libmv { +// TODO(keir): Switch this to use the smarter LM loop like in ESM. + // Computes U and e from the Ud = e equation (number 14) from the paper. static void ComputeTrackingEquation(const Array3Df &image_and_gradient1, const Array3Df &image_and_gradient2, @@ -79,10 +81,39 @@ static void ComputeTrackingEquation(const Array3Df &image_and_gradient1, *e = (A + lambda*Mat2f::Identity())*Di*(V - W) + 0.5*(S - R); } +bool RegionIsInBounds(const FloatImage &image1, + double x, double y, + int half_window_size) { + // Check the minimum coordinates. + int min_x = floor(x) - half_window_size - 1; + int min_y = floor(y) - half_window_size - 1; + if (min_x < 0.0 || + min_y < 0.0) { + return false; + } + + // Check the maximum coordinates. + int max_x = ceil(x) + half_window_size + 1; + int max_y = ceil(y) + half_window_size + 1; + if (max_x > image1.cols() || + max_y > image1.rows()) { + return false; + } + + // Ok, we're good. + return true; +} + bool TrkltRegionTracker::Track(const FloatImage &image1, const FloatImage &image2, double x1, double y1, double *x2, double *y2) const { + if (!RegionIsInBounds(image1, x1, y1, half_window_size)) { + LG << "Fell out of image1's window with x1=" << x1 << ", y1=" << y1 + << ", hw=" << half_window_size << "."; + return false; + } + Array3Df image_and_gradient1; Array3Df image_and_gradient2; BlurredImageAndDerivativesChannels(image1, sigma, &image_and_gradient1); @@ -91,6 +122,13 @@ bool TrkltRegionTracker::Track(const FloatImage &image1, int i; Vec2f d = Vec2f::Zero(); for (i = 0; i < max_iterations; ++i) { + // Check that the entire image patch is within the bounds of the images. + if (!RegionIsInBounds(image2, *x2, *y2, half_window_size)) { + LG << "Fell out of image2's window with x2=" << *x2 << ", y2=" << *y2 + << ", hw=" << half_window_size << "."; + return false; + } + // Compute gradient matrix and error vector. Mat2f U; Vec2f e; @@ -120,6 +158,8 @@ bool TrkltRegionTracker::Track(const FloatImage &image1, LG << "Determinant " << determinant << " is too small; failing tracking."; return false; } + LG << "x=" << *x2 << ", y=" << *y2 << ", dx=" << d[0] << ", dy=" << d[1] << ", det=" << determinant; + // If the update is small, then we probably found the target. if (d.squaredNorm() < min_update_squared_distance) { diff --git a/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.cpp b/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.cpp index 1c1f0cb2627..7eb2dfac5d9 100644 --- a/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.cpp +++ b/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.cpp @@ -158,6 +158,31 @@ namespace V3D switch (_mode) { + case FULL_BUNDLE_FOCAL_AND_RADIAL_K1: + { + // Focal length. + Ck[0][0] = xd[0]; + Ck[1][0] = xd[1]; + + // For radial, k1 only. + Matrix2x2d dxd_dk1k2 = _distortion.derivativeWrtRadialParameters(xu); + Matrix2x2d d_dk1k2 = dp_dxd * dxd_dk1k2; + Ck[0][1] = d_dk1k2[0][0]; + Ck[1][1] = d_dk1k2[1][0]; + break; + } + case FULL_BUNDLE_FOCAL_AND_RADIAL: + { + // Focal length. + Ck[0][0] = xd[0]; + Ck[1][0] = xd[1]; + + // Radial k1 and k2. + Matrix2x2d dxd_dk1k2 = _distortion.derivativeWrtRadialParameters(xu); + Matrix2x2d d_dk1k2 = dp_dxd * dxd_dk1k2; + copyMatrixSlice(d_dk1k2, 0, 0, 2, 2, Ck, 0, 1); + break; + } case FULL_BUNDLE_RADIAL_TANGENTIAL: { Matrix2x2d dxd_dp1p2 = _distortion.derivativeWrtTangentialParameters(xu); @@ -194,6 +219,21 @@ namespace V3D { switch (_mode) { + case FULL_BUNDLE_FOCAL_AND_RADIAL_K1: + { + _K[0][0] += deltaC[0]; + _K[1][1] = _cachedAspectRatio * _K[0][0]; + _distortion.k1 += deltaC[1]; + break; + } + case FULL_BUNDLE_FOCAL_AND_RADIAL: + { + _K[0][0] += deltaC[0]; + _K[1][1] = _cachedAspectRatio * _K[0][0]; + _distortion.k1 += deltaC[1]; + _distortion.k2 += deltaC[2]; + break; + } case FULL_BUNDLE_RADIAL_TANGENTIAL: { _distortion.p1 += deltaC[5]; diff --git a/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.h b/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.h index 076a9e64346..339e174ed9e 100644 --- a/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.h +++ b/extern/libmv/third_party/ssba/Geometry/v3d_metricbundle.h @@ -166,7 +166,9 @@ namespace V3D FULL_BUNDLE_FOCAL_LENGTH = 1, // f FULL_BUNDLE_FOCAL_LENGTH_PP = 2, // f, cx, cy FULL_BUNDLE_RADIAL = 3, // f, cx, cy, k1, k2 - FULL_BUNDLE_RADIAL_TANGENTIAL = 4 // f, cx, cy, k1, k2, p1, p2 + FULL_BUNDLE_RADIAL_TANGENTIAL = 4, // f, cx, cy, k1, k2, p1, p2 + FULL_BUNDLE_FOCAL_AND_RADIAL_K1 = 5, // f, k1 + FULL_BUNDLE_FOCAL_AND_RADIAL = 6, // f, k1, k2 }; struct CommonInternalsMetricBundleOptimizer : public MetricBundleOptimizerBase @@ -175,11 +177,13 @@ namespace V3D { switch (mode) { - case FULL_BUNDLE_METRIC: return 0; - case FULL_BUNDLE_FOCAL_LENGTH: return 1; - case FULL_BUNDLE_FOCAL_LENGTH_PP: return 3; - case FULL_BUNDLE_RADIAL: return 5; - case FULL_BUNDLE_RADIAL_TANGENTIAL: return 7; + case FULL_BUNDLE_METRIC: return 0; + case FULL_BUNDLE_FOCAL_LENGTH: return 1; + case FULL_BUNDLE_FOCAL_LENGTH_PP: return 3; + case FULL_BUNDLE_RADIAL: return 5; + case FULL_BUNDLE_RADIAL_TANGENTIAL: return 7; + case FULL_BUNDLE_FOCAL_AND_RADIAL_K1: return 2; + case FULL_BUNDLE_FOCAL_AND_RADIAL: return 3; } return 0; } @@ -266,11 +270,13 @@ namespace V3D { switch (mode) { - case FULL_BUNDLE_METRIC: return 0; - case FULL_BUNDLE_FOCAL_LENGTH: return 1; - case FULL_BUNDLE_FOCAL_LENGTH_PP: return 3; - case FULL_BUNDLE_RADIAL: return 5; - case FULL_BUNDLE_RADIAL_TANGENTIAL: return 7; + case FULL_BUNDLE_METRIC: return 0; + case FULL_BUNDLE_FOCAL_LENGTH: return 1; + case FULL_BUNDLE_FOCAL_LENGTH_PP: return 3; + case FULL_BUNDLE_RADIAL: return 5; + case FULL_BUNDLE_RADIAL_TANGENTIAL: return 7; + case FULL_BUNDLE_FOCAL_AND_RADIAL_K1: return 2; + case FULL_BUNDLE_FOCAL_AND_RADIAL: return 3; } return 0; } diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 55fc641f5ae..d14d3450942 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -161,6 +161,10 @@ class CLIP_PT_tools_solving(Panel): col.prop(settings, "keyframe_a") col.prop(settings, "keyframe_b") + col = layout.column(align=True) + col.label(text="Refine:") + col.prop(settings, "refine_intrinsics", text="") + class CLIP_PT_tools_cleanup(Panel): bl_space_type = 'CLIP_EDITOR' diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index a8fb2c836de..af852d49d82 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -91,6 +91,8 @@ void BKE_tracking_sync_user(struct MovieClipUser *user, struct MovieTrackingCont int BKE_tracking_next(struct MovieTrackingContext *context); /* Camera solving */ +int BKE_tracking_can_solve(struct MovieTracking *tracking, char *error_msg, int error_size); + float BKE_tracking_solve_reconstruction(struct MovieTracking *tracking, int width, int height); struct MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(struct MovieTracking *tracking, int framenr); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index d65840720cd..4989e8f1b55 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -47,6 +47,7 @@ #include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_path_util.h" +#include "BLI_string.h" #include "BKE_global.h" #include "BKE_tracking.h" @@ -1260,7 +1261,28 @@ static struct libmv_Tracks *create_libmv_tracks(MovieTracking *tracking, int wid return tracks; } -static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction) +static void retrieve_libmv_reconstruct_intrinscis(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction) +{ + struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_ReconstructionExtractIntrinsics(libmv_reconstruction); + + float aspy= 1.0f/tracking->camera.pixel_aspect; + + double focal_length, principal_x, principal_y, k1, k2, k3; + int width, height; + + libmv_CameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y, + &k1, &k2, &k3, &width, &height); + + tracking->camera.focal= focal_length; + tracking->camera.principal[0]= principal_x; + + /* todo: verify divide by aspy is correct */ + tracking->camera.principal[1]= principal_y / aspy; + tracking->camera.k1= k1; + tracking->camera.k2= k2; +} + +static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction) { int tracknr= 0; int sfra= INT_MAX, efra= INT_MIN, a, origin_set= 0; @@ -1373,8 +1395,69 @@ static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reco return ok; } +static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction) +{ + /* take the intrinscis back from libmv */ + retrieve_libmv_reconstruct_intrinscis(tracking, libmv_reconstruction); + + return retrieve_libmv_reconstruct_tracks(tracking, libmv_reconstruction); +} + +static int get_refine_intrinsics_flags(MovieTracking *tracking) +{ + int refine= tracking->settings.refine_camera_intrinsics; + int flags= 0; + + if(refine&REFINE_FOCAL_LENGTH) + flags|= LIBMV_REFINE_FOCAL_LENGTH; + + if(refine&REFINE_PRINCIPAL_POINT) + flags|= LIBMV_REFINE_PRINCIPAL_POINT; + + if(refine&REFINE_RADIAL_DISTORTION_K1) + flags|= REFINE_RADIAL_DISTORTION_K1; + + if(refine&REFINE_RADIAL_DISTORTION_K2) + flags|= REFINE_RADIAL_DISTORTION_K2; + + return flags; +} + +static int count_tracks_on_both_keyframes(MovieTracking *tracking) +{ + int tot= 0; + int frame1= tracking->settings.keyframe1, frame2= tracking->settings.keyframe2; + MovieTrackingTrack *track; + + track= tracking->tracks.first; + while(track) { + if(BKE_tracking_has_marker(track, frame1)) + if(BKE_tracking_has_marker(track, frame2)) + tot++; + + track= track->next; + } + + return tot; +} #endif +int BKE_tracking_can_solve(MovieTracking *tracking, char *error_msg, int error_size) +{ +#if WITH_LIBMV + if(count_tracks_on_both_keyframes(tracking)<8) { + BLI_strncpy(error_msg, "At least 8 tracks on both of keyframes are needed for reconstruction", error_size); + return 0; + } + + return 1; +#else + BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size); + + return 0; +#endif +} + float BKE_tracking_solve_reconstruction(MovieTracking *tracking, int width, int height) { #if WITH_LIBMV @@ -1384,6 +1467,7 @@ float BKE_tracking_solve_reconstruction(MovieTracking *tracking, int width, int struct libmv_Tracks *tracks= create_libmv_tracks(tracking, width, height*aspy); struct libmv_Reconstruction *reconstruction = libmv_solveReconstruction(tracks, tracking->settings.keyframe1, tracking->settings.keyframe2, + get_refine_intrinsics_flags(tracking), camera->focal, camera->principal[0], camera->principal[1]*aspy, camera->k1, camera->k2, camera->k3); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index e9006f5b1e9..1b08a9aee4c 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1504,24 +1504,6 @@ void CLIP_OT_track_markers(wmOperatorType *ot) /********************** solve camera operator *********************/ -static int check_solve_track_count(MovieTracking *tracking) -{ - int tot= 0; - int frame1= tracking->settings.keyframe1, frame2= tracking->settings.keyframe2; - MovieTrackingTrack *track; - - track= tracking->tracks.first; - while(track) { - if(BKE_tracking_has_marker(track, frame1)) - if(BKE_tracking_has_marker(track, frame2)) - tot++; - - track= track->next; - } - - return tot>=8; -} - static int solve_camera_exec(bContext *C, wmOperator *op) { SpaceClip *sc= CTX_wm_space_clip(C); @@ -1530,9 +1512,11 @@ static int solve_camera_exec(bContext *C, wmOperator *op) MovieTracking *tracking= &clip->tracking; int width, height; float error; + char error_msg[255]; + + if(!BKE_tracking_can_solve(tracking, error_msg, sizeof(error_msg))) { + BKE_report(op->reports, RPT_ERROR, error_msg); - if(!check_solve_track_count(tracking)) { - BKE_report(op->reports, RPT_ERROR, "At least 8 tracks on both of keyframes are needed for reconstruction"); return OPERATOR_CANCELLED; } diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index b359ea3544d..e1aff048626 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -123,6 +123,11 @@ typedef struct MovieTrackingSettings { /* ** reconstruction settings ** */ int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */ + /* ** which camera intrinsics to refine. uses on the REFINE_* flags */ + short refine_camera_intrinsics; + + char pad2[6]; + /* ** tool settings ** */ /* set scale */ @@ -203,6 +208,12 @@ enum { #define TRACKING_SPEED_QUARTER 4 #define TRACKING_SPEED_DOUBLE 5 +/* MovieTrackingSettings->refine_camera_intrinsics */ +#define REFINE_FOCAL_LENGTH (1<<0) +#define REFINE_PRINCIPAL_POINT (1<<1) +#define REFINE_RADIAL_DISTORTION_K1 (1<<2) +#define REFINE_RADIAL_DISTORTION_K2 (1<<4) + /* MovieTrackingStrabilization->flag */ #define TRACKING_2D_STABILIZATION (1<<0) #define TRACKING_AUTOSCALE (1<<1) diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 2c6384c75d8..3e783d06dc4 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -229,6 +229,23 @@ static void rna_def_trackingSettings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem refine_items[] = { + {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"}, + {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"}, + {REFINE_FOCAL_LENGTH| + REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Principal Point", "Refine focal length and principal point"}, + {REFINE_FOCAL_LENGTH| + REFINE_PRINCIPAL_POINT| + REFINE_RADIAL_DISTORTION_K1| + REFINE_RADIAL_DISTORTION_K2, + "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Principal Point, K1, K2", "Refine focal length, principal point and radial distortion K1 and K2"}, + {REFINE_FOCAL_LENGTH| + REFINE_RADIAL_DISTORTION_K1| + REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1. K2", "Refine focal length and radial distortion K1 and K2"}, + {REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1", "Refine focal length and radial distortion K1"}, + {0, NULL, 0, NULL, NULL} + }; + srna= RNA_def_struct(brna, "MovieTrackingSettings", NULL); RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings"); @@ -271,6 +288,13 @@ static void rna_def_trackingSettings(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "keyframe2"); RNA_def_property_ui_text(prop, "Keyframe B", "Second keyframe used for reconstruction initialization"); + /* intrinsics refinement during bundle adjustment */ + prop= RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_items(prop, refine_items); + RNA_def_property_ui_text(prop, "Refine", "Refine intrinsics during camera solving"); + /* tool settings */ /* distance */ From 0f82384fd02c0809f55b8b26e4b4ab291b821ff7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 06:41:32 +0000 Subject: [PATCH 039/203] Camera tracking: code cleanup --- extern/libmv/libmv-capi.cpp | 33 +++++---------------- extern/libmv/libmv-capi.h | 5 ++-- source/blender/blenkernel/intern/tracking.c | 30 ++++++++----------- 3 files changed, 23 insertions(+), 45 deletions(-) diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp index 4d17aa6f538..9d6cfd5d17a 100644 --- a/extern/libmv/libmv-capi.cpp +++ b/extern/libmv/libmv-capi.cpp @@ -59,13 +59,6 @@ # define snprintf _snprintf #endif -#define DEFAULT_WINDOW_HALFSIZE 5 - -typedef struct libmv_RegionTracker { - libmv::EsmRegionTracker *klt_region_tracker; - libmv::RegionTracker *region_tracker; -} libmv_RegionTracker; - typedef struct libmv_Reconstruction { libmv::EuclideanReconstruction reconstruction; @@ -113,22 +106,18 @@ void libmv_setLoggingVerbosity(int verbosity) /* ************ RegionTracker ************ */ -libmv_RegionTracker *libmv_regionTrackerNew(int max_iterations, int pyramid_level) +libmv_RegionTracker *libmv_regionTrackerNew(int max_iterations, int pyramid_level, int half_window_size) { libmv::EsmRegionTracker *klt_region_tracker = new libmv::EsmRegionTracker; - klt_region_tracker->half_window_size = DEFAULT_WINDOW_HALFSIZE; + klt_region_tracker->half_window_size = half_window_size; klt_region_tracker->max_iterations = max_iterations; klt_region_tracker->min_determinant = 1e-4; libmv::PyramidRegionTracker *region_tracker = new libmv::PyramidRegionTracker(klt_region_tracker, pyramid_level); - libmv_RegionTracker *configured_region_tracker = new libmv_RegionTracker; - configured_region_tracker->klt_region_tracker = klt_region_tracker; - configured_region_tracker->region_tracker = region_tracker; - - return configured_region_tracker; + return (libmv_RegionTracker *)region_tracker; } static void floatBufToImage(const float *buf, int width, int height, libmv::FloatImage *image) @@ -270,18 +259,11 @@ static void saveBytesImage(char *prefix, unsigned char *data, int width, int hei #endif int libmv_regionTrackerTrack(libmv_RegionTracker *libmv_tracker, const float *ima1, const float *ima2, - int width, int height, int half_window_size, - double x1, double y1, double *x2, double *y2) + int width, int height, double x1, double y1, double *x2, double *y2) { - libmv::RegionTracker *region_tracker; - libmv::EsmRegionTracker *klt_region_tracker; + libmv::RegionTracker *region_tracker = (libmv::RegionTracker *)libmv_tracker; libmv::FloatImage old_patch, new_patch; - klt_region_tracker = libmv_tracker->klt_region_tracker; - region_tracker = libmv_tracker->region_tracker; - - klt_region_tracker->half_window_size = half_window_size; - floatBufToImage(ima1, width, height, &old_patch); floatBufToImage(ima2, width, height, &new_patch); @@ -304,8 +286,9 @@ int libmv_regionTrackerTrack(libmv_RegionTracker *libmv_tracker, const float *im void libmv_regionTrackerDestroy(libmv_RegionTracker *libmv_tracker) { - delete libmv_tracker->region_tracker; - delete libmv_tracker; + libmv::RegionTracker *region_tracker= (libmv::RegionTracker *)libmv_tracker; + + delete region_tracker; } /* ************ Tracks ************ */ diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h index d378afc5ea8..8252a11739b 100644 --- a/extern/libmv/libmv-capi.h +++ b/extern/libmv/libmv-capi.h @@ -43,10 +43,9 @@ void libmv_startDebugLogging(void); void libmv_setLoggingVerbosity(int verbosity); /* RegionTracker */ -struct libmv_RegionTracker *libmv_regionTrackerNew(int max_iterations, int pyramid_level); +struct libmv_RegionTracker *libmv_regionTrackerNew(int max_iterations, int pyramid_level, int half_window_size); int libmv_regionTrackerTrack(struct libmv_RegionTracker *libmv_tracker, const float *ima1, const float *ima2, - int width, int height, int half_window_size, - double x1, double y1, double *x2, double *y2); + int width, int height, double x1, double y1, double *x2, double *y2); void libmv_regionTrackerDestroy(struct libmv_RegionTracker *libmv_tracker); /* SAD Tracker */ diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 4989e8f1b55..d236c053058 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -120,10 +120,6 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event) } } else if(event==CLAMP_SEARCH_DIM) { - float max_pyramid_level_factor = 1.0; - if (track->tracker == TRACKER_KLT) { - max_pyramid_level_factor = 1 << (track->pyramid_levels - 1); - } for(a= 0; a<2; a++) { /* search shouldn't be resized smaller than pattern */ track->search_min[a]= MIN2(pat_min[a], track->search_min[a]); @@ -146,7 +142,6 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event) } } } - else if(event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) { float dim[2]; sub_v2_v2v2(dim, track->pat_max, track->pat_min); @@ -619,18 +614,23 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u float search_size_y= (track->search_max[1]-track->search_min[1])*height; float pattern_size_x= (track->pat_max[0]-track->pat_min[0])*width; float pattern_size_y= (track->pat_max[1]-track->pat_min[1])*height; + int wndx, wndy; /* compute the maximum pyramid size */ - double search_to_pattern_ratio= MIN2(search_size_x, search_size_y) + float search_to_pattern_ratio= MIN2(search_size_x, search_size_y) / MAX2(pattern_size_x, pattern_size_y); - double log2_search_to_pattern_ratio = log(floor(search_to_pattern_ratio)) / M_LN2; + float log2_search_to_pattern_ratio = log(floor(search_to_pattern_ratio)) / M_LN2; int max_pyramid_levels= floor(log2_search_to_pattern_ratio + 1); /* try to accomodate the user's choice of pyramid level in a way * that doesn't cause the coarsest pyramid pattern to be larger * than the search size */ int level= MIN2(track_context->track->pyramid_levels, max_pyramid_levels); - track_context->region_tracker= libmv_regionTrackerNew(100, level); + + wndx= (int)((track->pat_max[0]-track->pat_min[0])*width)/2; + wndy= (int)((track->pat_max[1]-track->pat_min[1])*height)/2; + + track_context->region_tracker= libmv_regionTrackerNew(100, level, MAX2(wndx, wndy)); } else if(track_context->track->tracker==TRACKER_SAD) { /* nothing to initialize */ @@ -880,7 +880,7 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra while(a>=0 && amarkersnr) { int next= (context->backwards) ? a+1 : a-1; int is_keyframed= 0; - MovieTrackingMarker *marker= &track->markers[a]; + MovieTrackingMarker *cur_marker= &track->markers[a]; MovieTrackingMarker *next_marker= NULL; if(next>=0 && nextmarkersnr) @@ -890,11 +890,11 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra if(next_marker && next_marker->flag&MARKER_DISABLED) is_keyframed= 1; - is_keyframed|= (marker->flag&MARKER_TRACKED)==0; + is_keyframed|= (cur_marker->flag&MARKER_TRACKED)==0; if(is_keyframed) { - framenr= marker->framenr; - *marker_keyed= marker; + framenr= cur_marker->framenr; + *marker_keyed= cur_marker; break; } @@ -1080,7 +1080,6 @@ int BKE_tracking_next(MovieTrackingContext *context) onbound= 1; } else if(track_context->track->tracker==TRACKER_KLT) { - int wndx, wndy; float *patch_new; if(need_readjust) { @@ -1103,11 +1102,8 @@ int BKE_tracking_next(MovieTrackingContext *context) x2= pos[0]; y2= pos[1]; - wndx= (int)((track->pat_max[0]-track->pat_min[0])*ibuf_new->x)/2; - wndy= (int)((track->pat_max[1]-track->pat_min[1])*ibuf_new->y)/2; - tracked= libmv_regionTrackerTrack(track_context->region_tracker, track_context->patch, patch_new, - width, height, MAX2(wndx, wndy), x1, y1, &x2, &y2); + width, height, x1, y1, &x2, &y2); MEM_freeN(patch_new); } From f4745763514a51bf841fc2c344d62242bdc297da Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 06:41:42 +0000 Subject: [PATCH 040/203] Camera tracking: interface cleanup and small buttons renaming - Move tracking-related constraints to own section in list Currently there are only two constraints, so can look a bit odd, but it'll be other constraints like "Object Solver" and so. - Move motion-tracking parameters from 3D viewport Display panel to it's own panel. - Get rid of "Bundle" in 3d viewport. It's quite obvious that it's a 3D representation of tracks is used in 3D viewport and it shouldn't be so confusing for artists now. - Also get rid of "Bundle" in Follow Track constraint. Old files can change a bit because of changes in DNA. - Also get rid of "Bundles" in operator which creates vertices cloud from 3D position of tracks. - Rename "Principal Point" to "Optical Center" in the interface. --- release/scripts/startup/bl_operators/clip.py | 16 ++++---- .../bl_ui/properties_object_constraint.py | 5 ++- release/scripts/startup/bl_ui/space_clip.py | 7 ++-- release/scripts/startup/bl_ui/space_view3d.py | 41 ++++++++++++++----- source/blender/blenkernel/intern/constraint.c | 3 +- .../blender/makesdna/DNA_constraint_types.h | 11 ++--- .../blender/makesrna/intern/rna_constraint.c | 23 ++++------- source/blender/makesrna/intern/rna_space.c | 12 +++--- source/blender/makesrna/intern/rna_tracking.c | 4 +- 9 files changed, 66 insertions(+), 56 deletions(-) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 55592621112..203a1673c0b 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -63,16 +63,16 @@ class CLIP_OT_track_to_empty(Operator): constraint.clip = sc.clip constraint.track = track.name - constraint.reference = 'TRACK' + constraint.use_3d_position = False return {'FINISHED'} -class CLIP_OT_bundles_to_mesh(Operator): - """Create vertex cloud using coordinates of bundles""" +class CLIP_OT_tracks_to_mesh(Operator): + """Create vertex cloud using coordinates of tracks""" - bl_idname = "clip.bundles_to_mesh" - bl_label = "Bundles to Mesh" + bl_idname = "clip.tracks_to_mesh" + bl_label = "Tracks to Mesh" bl_options = {'UNDO', 'REGISTER'} @classmethod @@ -91,7 +91,7 @@ class CLIP_OT_bundles_to_mesh(Operator): new_verts = [] - mesh = bpy.data.meshes.new(name="Bundles") + mesh = bpy.data.meshes.new(name="Tracks") for track in clip.tracking.tracks: if track.has_bundle: new_verts.append(track.bundle) @@ -100,7 +100,7 @@ class CLIP_OT_bundles_to_mesh(Operator): mesh.vertices.add(len(new_verts)) mesh.vertices.foreach_set("co", unpack_list(new_verts)) - ob = bpy.data.objects.new(name="Bundles", object_data=mesh) + ob = bpy.data.objects.new(name="Tracks", object_data=mesh) bpy.context.scene.objects.link(ob) @@ -252,7 +252,7 @@ class CLIP_OT_constraint_to_fcurve(Operator): if not con: return - if con.type == 'FOLLOW_TRACK' and con.reference == 'BUNDLE': + if con.type == 'FOLLOW_TRACK' and con.use_3d_position: mat = ob.matrix_world.copy() ob.constraints.remove(con) ob.matrix_world = mat diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 508818b62dc..8cdb07461bb 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -754,14 +754,15 @@ class ConstraintButtonsPanel(): col.prop(con, "rotation_range", text="Pivot When") def FOLLOW_TRACK(self, context, layout, con): - layout.prop(con, "use_active_clip") + row = layout.row() + row.prop(con, "use_active_clip") + row.prop(con, "use_3d_position") if not con.use_active_clip: layout.prop(con, "clip") layout.prop(con, "track") - layout.row().prop(con, "reference", expand=True) layout.operator("clip.constraint_to_fcurve") diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index d14d3450942..968c583f1fe 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -205,7 +205,7 @@ class CLIP_PT_tools_geometry(Panel): def draw(self, context): layout = self.layout - layout.operator("clip.bundles_to_mesh") + layout.operator("clip.tracks_to_mesh") layout.operator("clip.track_to_empty") @@ -227,7 +227,6 @@ class CLIP_PT_tools_orientation(Panel): settings = sc.clip.tracking.settings col = layout.column(align=True) - col.label(text="Scene Orientation:") col.operator("clip.set_floor") col.operator("clip.set_origin") @@ -371,7 +370,7 @@ class CLIP_PT_tracking_camera(Panel): col.prop(clip.tracking.camera, "pixel_aspect") col = layout.column() - col.label(text="Principal Point") + col.label(text="Optical Center:") row = col.row() row.prop(clip.tracking.camera, "principal", text="") col.operator("clip.set_center_principal", text="Center") @@ -769,7 +768,7 @@ class CLIP_MT_reconstruction(Menu): layout.separator() layout.operator("clip.track_to_empty") - layout.operator("clip.bundles_to_mesh") + layout.operator("clip.tracks_to_mesh") class CLIP_MT_track_visibility(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 32ac4284267..97e40bfff30 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2165,16 +2165,6 @@ class VIEW3D_PT_view3d_display(Panel): layout.separator() - layout.prop(view, "show_reconstruction") - if view.show_reconstruction: - layout.label(text="Bundle type:") - layout.prop(view, "bundle_draw_type", text="") - layout.prop(view, "bundle_draw_size") - layout.prop(view, "show_bundle_name") - layout.prop(view, "show_camera_path") - - layout.separator() - region = view.region_quadview layout.operator("screen.region_quadview", text="Toggle Quad View") @@ -2190,6 +2180,37 @@ class VIEW3D_PT_view3d_display(Panel): row.prop(region, "use_box_clip") +class VIEW3D_PT_view3d_motion_tracking(Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Motion Tracking" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + view = context.space_data + return (view) + + def draw_header(self, context): + layout = self.layout + view = context.space_data + + layout.prop(view, "show_reconstruction", text="") + + def draw(self, context): + layout = self.layout + + view = context.space_data + + col = layout.column() + col.active = view.show_reconstruction + col.prop(view, "show_tracks_name", text="Show Names") + col.prop(view, "show_camera_path") + col.label(text="Tracks:") + col.prop(view, "tracks_draw_type", text="") + col.prop(view, "tracks_draw_size", text="Size") + + class VIEW3D_PT_view3d_meshdisplay(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index f904d6e66df..adc3f17f187 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3939,7 +3939,6 @@ static void followtrack_new_data (void *cdata) data->clip= NULL; data->flag|= FOLLOWTRACK_ACTIVECLIP; - data->reference= FOLLOWTRACK_TRACK; } static void followtrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata) @@ -3967,7 +3966,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase if(!track) return; - if(data->reference==FOLLOWTRACK_BUNDLE) { + if(data->flag&FOLLOWTRACK_USE_3D_POSITION) { if(track->flag&TRACK_HAS_BUNDLE) { float pos[3], mat[4][4], obmat[4][4]; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 3620131b8df..c85ef72d337 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -410,7 +410,7 @@ typedef struct bShrinkwrapConstraint { typedef struct bFollowTrackConstraint { struct MovieClip *clip; char track[24]; - int flag, reference; + int flag, pad; } bFollowTrackConstraint; /* Camera Solver constraints */ @@ -751,14 +751,9 @@ typedef enum ePivotConstraint_Flag { PIVOTCON_FLAG_ROTACT_NEG = (1<<1) } ePivotConstraint_Flag; -/* FollowTrack Constraint -> flag */ -typedef enum eFollowTrack_Reference { - FOLLOWTRACK_TRACK = (1<<0), - FOLLOWTRACK_BUNDLE = (1<<1) -} FollowTrack_Reference; - typedef enum eFollowTrack_Flags { - FOLLOWTRACK_ACTIVECLIP = (1<<0) + FOLLOWTRACK_ACTIVECLIP = (1<<0), + FOLLOWTRACK_USE_3D_POSITION = (1<<1) } eFollowTrack_Flags; /* CameraSolver Constraint -> flag */ diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e1e4f3929b2..0cd36eb3755 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -43,6 +43,9 @@ #include "WM_types.h" EnumPropertyItem constraint_type_items[] ={ + {0, "", 0, "Motion Tracking", ""}, + {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""}, + {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""}, {0, "", 0, "Transform", ""}, {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""}, {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""}, @@ -64,11 +67,9 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"}, {0, "", 0, "Relationship", ""}, {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""}, - {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""}, {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""}, {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""}, {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""}, - {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""}, {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""}, {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""}, {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""}, @@ -2037,11 +2038,6 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem reference_items[] = { - {FOLLOWTRACK_TRACK, "TRACK", 0, "Track", "Use 2D track position as reference"}, - {FOLLOWTRACK_BUNDLE, "BUNDLE", 0, "Bundle", "Use 3D reconstructed bundle position as reference"}, - {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track"); RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data"); @@ -2059,18 +2055,17 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); - /* reference */ - prop= RNA_def_property(srna, "reference", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "reference"); - RNA_def_property_enum_items(prop, reference_items); - RNA_def_property_ui_text(prop, "Reference", "Reference source to follow"); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - /* use default clip */ prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP); RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + /* use 3d position */ + prop= RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION); + RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_camera_solver(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 31f3d59e643..d2505fc9775 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1579,16 +1579,16 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); - prop= RNA_def_property(srna, "bundle_draw_size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_float_sdna(prop, NULL, "bundle_size"); - RNA_def_property_ui_text(prop, "Bundle Size", "Display size of bundles from reconstructed data"); + RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); - prop= RNA_def_property(srna, "bundle_draw_type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "tracks_draw_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype"); RNA_def_property_enum_items(prop, bundle_drawtype_items); - RNA_def_property_ui_text(prop, "Bundle Display Type", "Viewport display style for bundles"); + RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE); @@ -1596,9 +1596,9 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed path of camera"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); - prop= RNA_def_property(srna, "show_bundle_name", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "show_tracks_name", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME); - RNA_def_property_ui_text(prop, "Show Bundle Name", "Show names for bundle objects"); + RNA_def_property_ui_text(prop, "Show Tracks Name", "Show names for tracks objects"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* region */ diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 3e783d06dc4..4de39811d0b 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -233,12 +233,12 @@ static void rna_def_trackingSettings(BlenderRNA *brna) {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"}, {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"}, {REFINE_FOCAL_LENGTH| - REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Principal Point", "Refine focal length and principal point"}, + REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", "Refine focal length and optical center"}, {REFINE_FOCAL_LENGTH| REFINE_PRINCIPAL_POINT| REFINE_RADIAL_DISTORTION_K1| REFINE_RADIAL_DISTORTION_K2, - "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Principal Point, K1, K2", "Refine focal length, principal point and radial distortion K1 and K2"}, + "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Optical Center, K1, K2", "Refine focal length, optical center and radial distortion K1 and K2"}, {REFINE_FOCAL_LENGTH| REFINE_RADIAL_DISTORTION_K1| REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1. K2", "Refine focal length and radial distortion K1 and K2"}, From 11a7a406fb799843bc016e515d81a1c93d6d152e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 06:46:07 +0000 Subject: [PATCH 041/203] DPAINT_OT_output_toggle operator was using an index option for what was really a toggle between 2 values, changed its index option to an enum. if a value other than 1/0 was given it would use an uninitialized pointer too (compiler warning, review should pick up this stuff). also renamed some RNA attrs: output_name --> output_name_a output_name2 --> output_name_b do_output1 --> use_output_a do_output2 --> use_output_b do_smudge --> use_smudge max_velocity --> velocity_max --- .../bl_ui/properties_physics_dynamicpaint.py | 32 +++++++++---------- source/blender/blenkernel/BKE_dynamicpaint.h | 2 +- .../blender/blenkernel/intern/dynamicpaint.c | 6 ++-- .../editors/physics/dynamicpaint_ops.c | 23 +++++++------ .../makesrna/intern/rna_dynamicpaint.c | 13 ++++---- 5 files changed, 40 insertions(+), 36 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index a934e103c35..70dd7c04382 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -213,33 +213,33 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): # paintmap output row = layout.row() - row.prop_search(surface, "output_name", ob.data, "vertex_colors", text="Paintmap layer: ") + row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap layer: ") if surface.output_exists(object=ob, index=0): ic = 'ZOOMOUT' else: ic = 'ZOOMIN' - row.operator("dpaint.output_toggle", icon=ic, text="").index = 0 + row.operator("dpaint.output_toggle", icon=ic, text="").output = 'A' # wetmap output row = layout.row() - row.prop_search(surface, "output_name2", ob.data, "vertex_colors", text="Wetmap layer: ") + row.prop_search(surface, "output_name_b", ob.data, "vertex_colors", text="Wetmap layer: ") if surface.output_exists(object=ob, index=1): ic = 'ZOOMOUT' else: ic = 'ZOOMIN' - row.operator("dpaint.output_toggle", icon=ic, text="").index = 1 + row.operator("dpaint.output_toggle", icon=ic, text="").output = 'B' elif surface_type == 'WEIGHT': row = layout.row() - row.prop_search(surface, "output_name", ob, "vertex_groups", text="Vertex Group: ") + row.prop_search(surface, "output_name_a", ob, "vertex_groups", text="Vertex Group: ") if surface.output_exists(object=ob, index=0): ic = 'ZOOMOUT' else: ic = 'ZOOMIN' - row.operator("dpaint.output_toggle", icon=ic, text="").index = 0 + row.operator("dpaint.output_toggle", icon=ic, text="").output = 'A' # image format outputs if surface.surface_format == 'IMAGE': @@ -254,19 +254,19 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): if surface_type == 'PAINT': split = layout.split(percentage=0.4) - split.prop(surface, "do_output1", text="Paintmaps:") + split.prop(surface, "use_output_a", text="Paintmaps:") sub = split.row() - sub.active = surface.do_output1 - sub.prop(surface, "output_name", text="") + sub.active = surface.use_output_a + sub.prop(surface, "output_name_a", text="") split = layout.split(percentage=0.4) - split.prop(surface, "do_output2", text="Wetmaps:") + split.prop(surface, "do_output_b", text="Wetmaps:") sub = split.row() - sub.active = surface.do_output2 - sub.prop(surface, "output_name2", text="") + sub.active = surface.do_output_b + sub.prop(surface, "output_name_b", text="") else: col = layout.column() - col.prop(surface, "output_name", text="Filename: ") + col.prop(surface, "output_name_a", text="Filename: ") if surface_type == 'DISPLACE': col.prop(surface, "displace_type", text="Displace Type") col.prop(surface, "depth_clamp") @@ -454,14 +454,14 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel): col = layout.column() col.active = (brush.velocity_alpha or brush.velocity_color or brush.velocity_depth) - col.prop(brush, "max_velocity") + col.prop(brush, "velocity_max") col.template_color_ramp(brush, "velocity_ramp", expand=True) layout.separator() row = layout.row() - row.prop(brush, "do_smudge") + row.prop(brush, "use_smudge") sub = row.row() - sub.active = brush.do_smudge + sub.active = brush.use_smudge sub.prop(brush, "smudge_strength") diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index d7e0f8bdaae..a4a810ba177 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -64,7 +64,7 @@ void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface); void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface); int dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface); -int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int index); +int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int output); void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface); void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename); void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index ebbe57a6f81..5066b558c5a 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -279,13 +279,13 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface) } } -int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int index) +int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output) { char *name; - if (index == 0) + if (output == 0) name = surface->output_name; - else if (index == 1) + else if (output == 1) name = surface->output_name2; else return 0; diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 550da63d7aa..f30ff9c08e9 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -197,24 +197,23 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot) static int output_toggle_exec(bContext *C, wmOperator *op) { - Object *ob = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); DynamicPaintSurface *surface; DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint); - int index= RNA_int_get(op->ptr, "index"); + int output= RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */ if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED; surface = get_activeSurface(pmd->canvas); /* if type is already enabled, toggle it off */ if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) { - int exists = dynamicPaint_outputLayerExists(surface, ob, index); - char *name; + int exists = dynamicPaint_outputLayerExists(surface, ob, output); + const char *name; - if (index == 0) + if (output == 0) name = surface->output_name; - else if (index == 1) + else name = surface->output_name2; /* Vertex Color Layer */ @@ -226,8 +225,9 @@ static int output_toggle_exec(bContext *C, wmOperator *op) } /* Vertex Weight Layer */ else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { - if (!exists) + if (!exists) { ED_vgroup_add_name(ob, name); + } else { bDeformGroup *defgroup = defgroup_find_name(ob, name); if (defgroup) ED_vgroup_delete(ob, defgroup); @@ -240,7 +240,11 @@ static int output_toggle_exec(bContext *C, wmOperator *op) void DPAINT_OT_output_toggle(wmOperatorType *ot) { - PropertyRNA *prop; + static EnumPropertyItem prop_output_toggle_types[] = { + {0, "A", 0, "Output A", ""}, + {1, "B", 0, "Output B", ""}, + {0, NULL, 0, NULL, NULL} + }; /* identifiers */ ot->name= "Toggle Output Layer"; @@ -255,8 +259,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - prop= RNA_def_int(ot->srna, "index", 0, 0, 1, "Index", "", 0, 1); - ot->prop= prop; + ot->prop= RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", ""); } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 00a73afb789..974f8602440 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -553,20 +553,20 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures"); /* output for primary surface data */ - prop= RNA_def_property(srna, "output_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "output_name"); RNA_def_property_ui_text(prop, "Output name", ""); - prop= RNA_def_property(srna, "do_output1", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1); RNA_def_property_ui_text(prop, "Save layer", "Output name"); /* output for secondary sufrace data */ - prop= RNA_def_property(srna, "output_name2", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "output_name2"); RNA_def_property_ui_text(prop, "Output name", "Output name"); - prop= RNA_def_property(srna, "do_output2", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2); RNA_def_property_ui_text(prop, "Save layer", ""); @@ -774,7 +774,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2); RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves. Use 0.0 to disable"); - prop= RNA_def_property(srna, "do_smudge", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE); RNA_def_property_ui_text(prop, "Do Smudge", "Makes this brush to smudge existing paint as it moves"); @@ -783,7 +783,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2); RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength"); - prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "max_velocity"); RNA_def_property_range(prop, 0.0001, 10.0); RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2); RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence. (Blender units per frame)"); From 972debc7eb7bd16e4f804dc70adffe5b534df3e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 07:07:59 +0000 Subject: [PATCH 042/203] make rna naming for dynamic paint consistent with existing names & conventions. --- .../bl_ui/properties_physics_dynamicpaint.py | 28 +++++++-------- .../makesrna/intern/rna_dynamicpaint.c | 34 ++++++++----------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 70dd7c04382..251606a6341 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -99,8 +99,8 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel): split = layout.split() col = split.column() - col.prop(brush, "absolute_alpha") - col.prop(brush, "paint_erase") + col.prop(brush, "use_absolute_alpha") + col.prop(brush, "use_paint_erase") col.prop(brush, "paint_wetness", text="Wetness") col = split.column() @@ -168,7 +168,7 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel): row.prop(surface, "displace_factor") elif surface_type == 'WAVE': - layout.prop(surface, "wave_open_borders") + layout.prop(surface, "use_wave_open_border") split = layout.split() @@ -250,7 +250,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): layout.prop(surface, "image_output_path", text="") row = layout.row() row.prop(surface, "image_fileformat", text="") - row.prop(surface, "premultiply", text="Premultiply alpha") + row.prop(surface, "use_premultiply", text="Premultiply alpha") if surface_type == 'PAINT': split = layout.split(percentage=0.4) @@ -367,7 +367,7 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel): md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active and - md.canvas_settings.canvas_surfaces.active.uses_cache) + md.canvas_settings.canvas_surfaces.active.is_cache_user) def draw(self, context): layout = self.layout @@ -411,21 +411,21 @@ class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, Panel): split = layout.row().split(percentage=0.4) sub = split.column() if brush.paint_source == 'DISTANCE': - sub.prop(brush, "proximity_project") + sub.prop(brush, "use_proximity_project") elif brush.paint_source == 'VOLUME_DISTANCE': - sub.prop(brush, "proximity_inverse") - sub.prop(brush, "negate_volume") + sub.prop(brush, "invert_proximity") + sub.prop(brush, "use_negative_volume") sub = split.column() if brush.paint_source == 'DISTANCE': column = sub.column() - column.active = brush.proximity_project + column.active = brush.use_proximity_project column.prop(brush, "ray_direction") sub.prop(brush, "proximity_falloff") if brush.proximity_falloff == 'RAMP': col = layout.row().column() col.separator() - col.prop(brush, "proximity_ramp_alpha", text="Only Use Alpha") + col.prop(brush, "use_proximity_ramp_alpha", text="Only Use Alpha") col.template_color_ramp(brush, "paint_ramp", expand=True) @@ -447,13 +447,13 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel): split = layout.split() col = split.column() - col.prop(brush, "velocity_alpha") - col.prop(brush, "velocity_color") + col.prop(brush, "use_velocity_alpha") + col.prop(brush, "use_velocity_color") - split.prop(brush, "velocity_depth") + split.prop(brush, "use_velocity_depth") col = layout.column() - col.active = (brush.velocity_alpha or brush.velocity_color or brush.velocity_depth) + col.active = (brush.use_velocity_alpha or brush.use_velocity_color or brush.use_velocity_depth) col.prop(brush, "velocity_max") col.template_color_ramp(brush, "velocity_ramp", expand=True) layout.separator() diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 974f8602440..640361e2b2e 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -197,17 +197,13 @@ static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value) } /* is point cache used */ -static int rna_DynamicPaint_uses_cache_get(PointerRNA *ptr) +static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) { DynamicPaintSurface *surface= (DynamicPaintSurface*)ptr->data; return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; } -static void rna_DynamicPaint_uses_cache_set(PointerRNA *ptr, int value) -{ -} - /* does output layer exist*/ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { @@ -543,7 +539,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) /* * Output settings */ - prop= RNA_def_property(srna, "premultiply", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA); RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiplies color by alpha. (Recommended for Blender input)"); @@ -641,7 +637,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2); RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero"); - prop= RNA_def_property(srna, "wave_open_borders", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS); RNA_def_property_ui_text(prop, "Open Borders", "Passes waves through mesh edges"); @@ -653,10 +649,10 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Point Cache", ""); /* is cache used */ - prop= RNA_def_property(srna, "uses_cache", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_uses_cache_get", "rna_DynamicPaint_uses_cache_set"); + prop= RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); RNA_def_property_ui_text(prop, "Uses Cache", ""); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE); } static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna) @@ -743,7 +739,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "absolute_alpha", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA); RNA_def_property_ui_text(prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing"); @@ -754,7 +750,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness. Visible in wetmap. Some effects only affect wet paint"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "paint_erase", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE); RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); @@ -789,17 +785,17 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2); RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence. (Blender units per frame)"); - prop= RNA_def_property(srna, "velocity_alpha", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA); RNA_def_property_ui_text(prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "velocity_depth", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH); RNA_def_property_ui_text(prop, "Multiply Depth", "Multiply brush intersection depth (displace, waves) by velocity ramp alpha"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "velocity_color", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR); RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); @@ -821,7 +817,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA); RNA_def_property_ui_text(prop, "Only Use Alpha", "Only reads color ramp alpha"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); @@ -833,7 +829,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "proximity_project", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT); RNA_def_property_ui_text(prop, "Project", "Brush is projected to canvas from defined direction within brush proximity"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); @@ -844,12 +840,12 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Ray Direction", "Defines ray direction to use for projection. If brush object is located in that direction it's painted"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "proximity_inverse", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX); RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); - prop= RNA_def_property(srna, "negate_volume", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME); RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); From c8f374f4865f304ab972f89152878ad056961e93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 07:18:32 +0000 Subject: [PATCH 043/203] make ocean rna more consistent with existing rna names --- .../startup/bl_ui/properties_data_modifier.py | 16 ++++++------ source/blender/makesrna/intern/rna_modifier.c | 26 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index b30958cbcc2..e685de416ed 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -415,7 +415,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): row.label() def OCEAN(self, layout, ob, md): - if not md.build_enabled: + if not md.is_build_enabled: layout.label("Built without OceanSim modifier") return @@ -441,7 +441,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.prop(md, "choppiness") col.prop(md, "wave_scale", text="Scale") - col.prop(md, "smallest_wave") + col.prop(md, "wave_scale_min") col.prop(md, "wind_velocity") col = split.column() @@ -449,16 +449,16 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): sub = col.column() sub.active = md.wave_alignment > 0 sub.prop(md, "wave_direction", text="Direction") - sub.prop(md, "damp") + sub.prop(md, "damping") layout.separator() - layout.prop(md, "generate_normals") + layout.prop(md, "use_normals") row = layout.row() - row.prop(md, "generate_foam") + row.prop(md, "use_foam") sub = row.row() - sub.active = md.generate_foam + sub.active = md.use_foam sub.prop(md, "foam_coverage", text="Coverage") layout.separator() @@ -472,8 +472,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split.enabled = not md.is_cached col = split.column(align=True) - col.prop(md, "bake_start", text="Start") - col.prop(md, "bake_end", text="End") + col.prop(md, "frame_start", text="Start") + col.prop(md, "frame_end", text="End") col = split.column(align=True) col.label(text="Cache path:") diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 0752a781ca7..b95224e6703 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -652,13 +652,13 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value) md->projectors[a]= NULL; } -static int rna_OceanModifier_build_enabled_get(PointerRNA *UNUSED(ptr)) +static int rna_OceanModifier_is_build_enabled_get(PointerRNA *UNUSED(ptr)) { - #ifdef WITH_OCEANSIM +#ifdef WITH_OCEANSIM return 1; - #else // WITH_OCEANSIM +#else // WITH_OCEANSIM return 0; - #endif // WITH_OCEANSIM +#endif // WITH_OCEANSIM } static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -2879,9 +2879,9 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_struct_sdna(srna, "OceanModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); - /* General check if OceanSim modifier code is enabled */ - prop= RNA_def_property(srna, "build_enabled", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_OceanModifier_build_enabled_get", NULL); + /* General check if blender was built with OceanSim modifier support */ + prop= RNA_def_property(srna, "is_build_enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_OceanModifier_is_build_enabled_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Build Enabled", "True if the OceanSim modifier is enabled in this build"); @@ -2913,13 +2913,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Repeat Y", "Repetitions of the generated surface in Y"); RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update"); - prop= RNA_def_property(srna, "generate_normals", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Generate Normals", "Outputs normals for bump mapping - disabling can speed up performance if its not needed"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop= RNA_def_property(srna, "generate_foam", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Generate Foam", "Generates foam mask as a vertex color channel"); @@ -2945,13 +2945,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed (m/s)"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_FACTOR); + prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "damp"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Damping", "Damp reflected waves going in opposite direction to the wind"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop= RNA_def_property(srna, "smallest_wave", PROP_FLOAT, PROP_DISTANCE); + prop= RNA_def_property(srna, "wave_scale_min", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "smallest_wave"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, FLT_MAX); @@ -3012,13 +3012,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Seed", ""); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop= RNA_def_property(srna, "bake_start", PROP_INT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bakestart"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Bake Start", ""); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop= RNA_def_property(srna, "bake_end", PROP_INT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bakeend"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Bake End", ""); From ad943db0e334e2e465a434854b6cd71344b63299 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Mon, 14 Nov 2011 08:06:24 +0000 Subject: [PATCH 044/203] Fix for #29241, ocean sim modifier crash when removing all vertices. The object draw method did not check for valid data when mapping back to original face, constructive modifier on empty mesh does that. --- source/blender/editors/space_view3d/drawobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 21fcc067764..4aed9f3fc2e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2696,7 +2696,8 @@ static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UN { EditFace *efa = EM_get_face_for_index(index); - if (efa->h==0) { + /* efa=0 for constructive modifier on empty mesh */ + if (efa && efa->h==0) { GPU_enable_material(efa->mat_nr+1, NULL); return 1; } From 5a01ec56da296ae211acb4e1be1e1d03f042cb82 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Mon, 14 Nov 2011 08:18:04 +0000 Subject: [PATCH 045/203] Fix for [#29247] Incorrect black color with dynamic paint --- source/blender/blenkernel/intern/dynamicpaint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 5066b558c5a..13eb59695b9 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -4139,13 +4139,13 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force totalAlpha += ePoint->e_alpha; /* do color mixing */ - if (color_mix) mixColors(pPoint->e_color, pPoint->e_alpha, ePoint->e_color, color_mix); + if (color_mix > MIN_WETNESS) mixColors(pPoint->e_color, pPoint->e_alpha, ePoint->e_color, color_mix); /* Check if neighbouring point has higher wetness, * if so, add it's wetness to this point as well*/ if (ePoint->wetness <= pPoint->wetness) continue; w_factor = ePoint->wetness/numOfNeighs * (ePoint->wetness - pPoint->wetness) * speed_scale; - if (w_factor <= 0.0f) continue; + if (w_factor <= MIN_WETNESS) continue; if (ePoint->e_alpha > pPoint->e_alpha) { alphaAdd = ePoint->e_alpha/numOfNeighs * (ePoint->wetness*ePoint->e_alpha - pPoint->wetness*pPoint->e_alpha) * speed_scale; From a7ed8f5e4aded700f11c6790da2e669487501e47 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 08:43:09 +0000 Subject: [PATCH 046/203] fix for shiftx/y for recently added VIEW3D_OT_camera_to_view_selected operator. --- source/blender/blenkernel/intern/camera.c | 53 ++++++++++++++++++----- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 0f973273b32..6ba7a76dd5c 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -421,6 +421,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data) /* dont move the camera, just yield the fit location */ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3]) { + float shift[2]; float plane_tx[4][3]; float rot_obmat[3][3]; const float zero[3]= {0,0,0}; @@ -433,6 +434,21 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam copy_m3_m4(rot_obmat, camera_ob->obmat); normalize_m3(rot_obmat); + for (i= 0; i < 4; i++) { + /* normalize so Z is always 1.0f*/ + mul_v3_fl(data_cb.frame_tx[i], 1.0f/data_cb.frame_tx[i][2]); + } + + /* get the shift back out of the frame */ + shift[0]= (data_cb.frame_tx[0][0] + + data_cb.frame_tx[1][0] + + data_cb.frame_tx[2][0] + + data_cb.frame_tx[3][0]) / 4.0f; + shift[1]= (data_cb.frame_tx[0][1] + + data_cb.frame_tx[1][1] + + data_cb.frame_tx[2][1] + + data_cb.frame_tx[3][1]) / 4.0f; + for (i= 0; i < 4; i++) { mul_m3_v3(rot_obmat, data_cb.frame_tx[i]); } @@ -456,8 +472,8 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam return FALSE; } else { - float plane_isect_1[3], plane_isect_1_other[3]; - float plane_isect_2[3], plane_isect_2_other[3]; + float plane_isect_1[3], plane_isect_1_no[3], plane_isect_1_other[3]; + float plane_isect_2[3], plane_isect_2_no[3], plane_isect_2_other[3]; float plane_isect_pt_1[3], plane_isect_pt_2[3]; @@ -466,10 +482,10 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]); } - if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_other, + if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_no, plane_tx[0], data_cb.normal_tx[0], plane_tx[2], data_cb.normal_tx[2]) == 0) || - (isect_plane_plane_v3(plane_isect_2, plane_isect_2_other, + (isect_plane_plane_v3(plane_isect_2, plane_isect_2_no, plane_tx[1], data_cb.normal_tx[1], plane_tx[3], data_cb.normal_tx[3]) == 0)) { @@ -478,8 +494,8 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam } else { - add_v3_v3(plane_isect_1_other, plane_isect_1); - add_v3_v3(plane_isect_2_other, plane_isect_2); + add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no); + add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no); if (isect_line_line_v3(plane_isect_1, plane_isect_1_other, plane_isect_2, plane_isect_2_other, @@ -489,12 +505,29 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam } else { float cam_plane_no[3]= {0.0f, 0.0f, -1.0f}; - float tvec[3]; + float plane_isect_delta[3]; + float plane_isect_delta_len; + mul_m3_v3(rot_obmat, cam_plane_no); - sub_v3_v3v3(tvec, plane_isect_pt_2, plane_isect_pt_1); - copy_v3_v3(r_co, dot_v3v3(tvec, cam_plane_no) > 0.0f ? - plane_isect_pt_1 : plane_isect_pt_2); + sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1); + plane_isect_delta_len= len_v3(plane_isect_delta); + + if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) { + copy_v3_v3(r_co, plane_isect_pt_1); + + /* offset shift */ + normalize_v3(plane_isect_1_no); + madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len); + } + else { + copy_v3_v3(r_co, plane_isect_pt_2); + + /* offset shift */ + normalize_v3(plane_isect_2_no); + madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len); + } + return TRUE; } From 36c073ab2a94bd3e2908b13e6e7d07bfdb73ce9a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 14 Nov 2011 10:35:11 +0000 Subject: [PATCH 047/203] mingw compiles again after OceanSim stuff --- build_files/scons/config/win32-mingw-config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index 87f819db7d1..51f438e0a4d 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -94,7 +94,7 @@ BF_OPENJPEG_LIB = '' BF_OPENJPEG_INC = '${BF_OPENJPEG}' BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' -WITH_BF_FFTW3 = False +WITH_BF_FFTW3 = True BF_FFTW3 = LIBDIR + '/gcc/fftw3' BF_FFTW3_INC = '${BF_FFTW3}/include' BF_FFTW3_LIB = 'fftw3' From 1a6d88401899942a7989f450aea2b7194760ddbd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 10:47:34 +0000 Subject: [PATCH 048/203] Fixed compilation error with msvc caused by recent libmv commit --- extern/libmv/libmv/tracking/esm_region_tracker.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extern/libmv/libmv/tracking/esm_region_tracker.cc b/extern/libmv/libmv/tracking/esm_region_tracker.cc index 2e5c255e153..01edee3bbb5 100644 --- a/extern/libmv/libmv/tracking/esm_region_tracker.cc +++ b/extern/libmv/libmv/tracking/esm_region_tracker.cc @@ -18,6 +18,8 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. +#define _USE_MATH_DEFINES + #include "libmv/tracking/esm_region_tracker.h" #include "libmv/logging/logging.h" From 9a2174f57a690424bc390b5fd08461c8e58d9393 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Mon, 14 Nov 2011 11:17:07 +0000 Subject: [PATCH 049/203] Better fix for crashes when rendering original edit mesh faces on empty edit mesh with constructive modifier (#29241). This avoids the additional test inside the loop. --- .../blender/editors/space_view3d/drawobject.c | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4aed9f3fc2e..a9fe6e317e3 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2696,8 +2696,7 @@ static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UN { EditFace *efa = EM_get_face_for_index(index); - /* efa=0 for constructive modifier on empty mesh */ - if (efa && efa->h==0) { + if (efa->h==0) { GPU_enable_material(efa->mat_nr+1, NULL); return 1; } @@ -2736,29 +2735,35 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(dt>OB_WIRE) { if(CHECK_OB_DRAWTEXTURE(v3d, dt)) { if(draw_glsl_material(scene, ob, v3d, dt)) { - glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); + /* if em has no faces the drawMappedFaces callback will fail */ + if(em->faces.first) { + glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material, - draw_em_fancy__setGLSLFaceOpts, NULL); - GPU_disable_material(); + finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material, + draw_em_fancy__setGLSLFaceOpts, NULL); + GPU_disable_material(); - glFrontFace(GL_CCW); + glFrontFace(GL_CCW); + } } else { draw_mesh_textured(scene, v3d, rv3d, ob, finalDM, 0); } } else { - /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */ - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); + /* if em has no faces the drawMappedFaces callback will fail */ + if(em->faces.first) { + /* 3 floats for position, 3 for normal and times two because the faces may actually be quads instead of triangles */ + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); - glEnable(GL_LIGHTING); - glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); + glEnable(GL_LIGHTING); + glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL); + finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL); - glFrontFace(GL_CCW); - glDisable(GL_LIGHTING); + glFrontFace(GL_CCW); + glDisable(GL_LIGHTING); + } } // Setup for drawing wire over, disable zbuffer From 74387f44af005a2b5327162bb6e06a34c4a5e2cd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 12:47:47 +0000 Subject: [PATCH 050/203] Fix #29252: GLSL not working with geometry material node after recent changes. --- .../gpu/intern/gpu_shader_material.glsl | 3 +- .../gpu/intern/gpu_shader_material.glsl.c | 176 +++++++++--------- 2 files changed, 91 insertions(+), 88 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 4a9d793aaad..0c24b4d7c7e 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -122,7 +122,7 @@ void uv_attribute(vec2 attuv, out vec3 uv) uv = vec3(attuv*2.0 - vec2(1.0, 1.0), 0.0); } -void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 attvcol, out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv, out vec3 normal, out vec4 vcol, out float frontback) +void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 attvcol, out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv, out vec3 normal, out vec4 vcol, out float vcol_alpha, out float frontback) { local = co; view = normalize(local); @@ -131,6 +131,7 @@ void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 att uv_attribute(attuv, uv); normal = -normalize(nor); /* blender render normal is negated */ vcol_attribute(attvcol, vcol); + vcol_alpha = attvcol.a; frontback = 1.0; } diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index e284c42532b..f64152a200a 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,93 +1,95 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 46289; +int datatoc_gpu_shader_material_glsl_size= 46336; char datatoc_gpu_shader_material_glsl[]= { - 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101, -114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, - 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118, -101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, - 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, - 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97, -120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40, -114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99, -100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9, -105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, - 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, - 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, - 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97, -120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105, -102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, - 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, - 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, - 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105, -102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99, -111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, - 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, - 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, - 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105, -102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, - 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, - 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111, -114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40, -102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, - 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, - 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, - 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, - 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101, -108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32, -118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, - 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, - 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115, -101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99, -111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32, -115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, - 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, - 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9, -114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, - 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95, -115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, - 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, - 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111, -119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115, -114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32, -111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115, -114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99, -111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95, -102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110, -101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, - 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, - 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111, -108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, - 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108, -105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99, -111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95, -102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, - 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, - 57, 51, 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, - 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, - 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111, -108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, - 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46, -120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111, -108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114, -105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, - 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, - 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, - 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118, -101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116, -116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, - 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111, -110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110, -111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119, -105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111, -114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116, -117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111, -114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32, -110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, 99, -111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, + + 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114, +101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32, +104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, + 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, + 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, + 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109, +105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, + 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, + 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, + 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, + 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46, +120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, + 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, + 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, + 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, + 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, + 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, + 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118, +101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, + 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, + 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, + 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114, +103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, + 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, + 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, + 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, + 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, + 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, + 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32, +112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118, +101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, + 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105, +102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, + 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, + 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, + 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32, +104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114, +103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, + 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, + 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, + 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108, +111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, + 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, + 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9, +114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, + 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, + 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, + 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, + 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95, +116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116, +111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, + 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, +118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95, +102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, + 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, +114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, + 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97, +114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116, +111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, + 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, + 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, + 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111, +108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111, +108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117, +118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116, +117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, + 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, + 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, + 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, + 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32, +117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99, +111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118, +105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, + 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46, +120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98, +117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97, +108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114, +109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116, +101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, + 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, From 8cf563530dbfda3c54ba6c269e037cc7cee00287 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Mon, 14 Nov 2011 12:55:46 +0000 Subject: [PATCH 051/203] Scons: make sure fftw is enabled when ocean_mod is compiled --- SConstruct | 1 + 1 file changed, 1 insertion(+) diff --git a/SConstruct b/SConstruct index 57da56872aa..b5075aa4345 100644 --- a/SConstruct +++ b/SConstruct @@ -332,6 +332,7 @@ if env['WITH_BF_FLUID'] == 1: # build with ocean sim? if env['WITH_BF_OCEANSIM'] == 1: + env['WITH_BF_FFTW3'] = 1 # ocean needs fftw3 so enable it env['CPPFLAGS'].append('-DWITH_MOD_OCEANSIM') From 1ace39c86bf54271cdc2ce7ae5bb4166715cd02a Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 14 Nov 2011 14:02:19 +0000 Subject: [PATCH 052/203] Apply patch [#28632] Add individual invert to 3d mouse in turntable mode and when zooming Submitted by Rainer Wahler This patch adds the individual invert options for the turntable mode too. In turntable mode there are only the rotate and roll and no tilt axis to invert. --- .../scripts/startup/bl_ui/space_userpref.py | 10 ++++--- .../editors/space_view3d/view3d_edit.c | 26 ++++++------------- source/blender/makesdna/DNA_userdef_types.h | 1 - source/blender/makesrna/intern/rna_userdef.c | 6 ----- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 51f55fe019c..665d790f832 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -765,10 +765,9 @@ class USERPREF_MT_ndof_settings(Menu): layout.label(text="Orbit options") if input_prefs.view_rotate_method == 'TRACKBALL': layout.prop(input_prefs, "ndof_roll_invert_axis") - layout.prop(input_prefs, "ndof_tilt_invert_axis") - layout.prop(input_prefs, "ndof_rotate_invert_axis") - else: - layout.prop(input_prefs, "ndof_orbit_invert_axes") + layout.prop(input_prefs, "ndof_tilt_invert_axis") + layout.prop(input_prefs, "ndof_rotate_invert_axis") + layout.prop(input_prefs, "ndof_zoom_invert") layout.separator() layout.label(text="Pan options") @@ -776,6 +775,9 @@ class USERPREF_MT_ndof_settings(Menu): layout.prop(input_prefs, "ndof_pany_invert_axis") layout.prop(input_prefs, "ndof_panz_invert_axis") + layout.label(text="Zoom options") + layout.prop(input_prefs, "ndof_zoom_updown") + layout.separator() layout.label(text="Fly options") layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY') diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0329b6c3739..7eaa5d42dd0 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1031,21 +1031,17 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event rv3d->view = RV3D_VIEW_USER; if (U.flag & USER_TRACKBALL) { - const int invert_roll = U.ndof_flag & NDOF_ROLL_INVERT_AXIS; - const int invert_tilt = U.ndof_flag & NDOF_TILT_INVERT_AXIS; - const int invert_rot = U.ndof_flag & NDOF_ROTATE_INVERT_AXIS; - float rot[4]; float axis[3]; float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis); - if (invert_roll) + if (U.ndof_flag & NDOF_ROLL_INVERT_AXIS) axis[2] = -axis[2]; - if (invert_tilt) + if (U.ndof_flag & NDOF_TILT_INVERT_AXIS) axis[0] = -axis[0]; - if (invert_rot) + if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS) axis[1] = -axis[1]; // transform rotation axis from view to world coordinates @@ -1061,8 +1057,6 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot); } else { /* turntable view code by John Aughey, adapted for 3D mouse by [mce] */ - const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES; - float angle, rot[4]; float xvec[3] = {1,0,0}; @@ -1071,7 +1065,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event /* Perform the up/down rotation */ angle = rot_sensitivity * dt * ndof->rvec[0]; - if (invert) + if (U.ndof_flag & NDOF_TILT_INVERT_AXIS) angle = -angle; rot[0] = cos(angle); mul_v3_v3fl(rot+1, xvec, sin(angle)); @@ -1079,7 +1073,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event /* Perform the orbital rotation */ angle = rot_sensitivity * dt * ndof->rvec[1]; - if (invert) + if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS) angle = -angle; // update the onscreen doo-dad @@ -1164,23 +1158,19 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) const float vertical_sensitivity = 0.4f; const float lateral_sensitivity = 0.6f; - const int invert_panx = U.ndof_flag & NDOF_PANX_INVERT_AXIS; - const int invert_pany = U.ndof_flag & NDOF_PANY_INVERT_AXIS; - const int invert_panz = U.ndof_flag & NDOF_PANZ_INVERT_AXIS; - float pan_vec[3]; - if (invert_panx) + if (U.ndof_flag & NDOF_PANX_INVERT_AXIS) pan_vec[0] = -lateral_sensitivity * ndof->tvec[0]; else pan_vec[0] = lateral_sensitivity * ndof->tvec[0]; - if (invert_panz) + if (U.ndof_flag & NDOF_PANZ_INVERT_AXIS) pan_vec[1] = -vertical_sensitivity * ndof->tvec[1]; else pan_vec[1] = vertical_sensitivity * ndof->tvec[1]; - if (invert_pany) + if (U.ndof_flag & NDOF_PANY_INVERT_AXIS) pan_vec[2] = -forward_sensitivity * ndof->tvec[2]; else pan_vec[2] = forward_sensitivity * ndof->tvec[2]; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 76d52d5b6d4..0655b0b78b0 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -605,7 +605,6 @@ extern UserDef U; /* from blenkernel blender.c */ */ /* actually... users probably don't care about what the mode is called, just that it feels right */ -#define NDOF_ORBIT_INVERT_AXES (1 << 6) /* zoom is up/down if this flag is set (otherwise forward/backward) */ #define NDOF_ZOOM_UPDOWN (1 << 7) #define NDOF_ZOOM_INVERT (1 << 8) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 09b712fbfaf..4c53011390f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2954,12 +2954,6 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation"); /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/ - /* 3D view: orbit */ - prop= RNA_def_property(srna, "ndof_orbit_invert_axes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ORBIT_INVERT_AXES); - RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed"); - /* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' */ - /* 3D view: roll */ prop= RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROLL_INVERT_AXIS); From 9e6860d864d0f630f92f2fb7130412e9387aea26 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 14:42:47 +0000 Subject: [PATCH 053/203] fix [#29242] menus have no keyboard shortcuts --- .../bl_ui/properties_object_constraint.py | 1 - source/blender/blenkernel/intern/tracking.c | 1 + source/blender/editors/include/UI_interface.h | 1 + source/blender/editors/interface/interface.c | 53 ++++++++++++++++--- .../editors/interface/interface_handlers.c | 2 +- .../editors/interface/interface_layout.c | 11 ++++ .../editors/interface/interface_regions.c | 6 +-- .../editors/interface/interface_templates.c | 2 +- .../editors/interface/interface_widgets.c | 11 ++-- source/blender/windowmanager/WM_api.h | 1 - source/blender/windowmanager/WM_keymap.h | 2 +- source/blender/windowmanager/intern/wm.c | 20 ------- .../blender/windowmanager/intern/wm_keymap.c | 10 ++-- .../windowmanager/intern/wm_operators.c | 2 +- 14 files changed, 78 insertions(+), 45 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 8cdb07461bb..1ff9a8a0449 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -763,7 +763,6 @@ class ConstraintButtonsPanel(): layout.prop(con, "track") - layout.operator("clip.constraint_to_fcurve") def CAMERA_SOLVER(self, context, layout, con): diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index d236c053058..d582ad7c4d8 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1449,6 +1449,7 @@ int BKE_tracking_can_solve(MovieTracking *tracking, char *error_msg, int error_s return 1; #else BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size); + (void)tracking; return 0; #endif diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 35fabb3b80e..01273b291a2 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -688,6 +688,7 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr); const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PropertyRNA *), const char label_align, const short flag); +struct MenuType *uiButGetMenuType(uiBut *but); void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext); void uiLayoutSetActive(uiLayout *layout, int active); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 81b42277055..ce4e052bd53 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -48,6 +48,8 @@ #include "BKE_context.h" #include "BKE_library.h" #include "BKE_unit.h" +#include "BKE_screen.h" +#include "BKE_idprop.h" #include "BKE_utildefines.h" /* FILE_MAX */ #include "BIF_gl.h" @@ -793,26 +795,61 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) { uiBut *but; - IDProperty *prop; char buf[512]; + /* for menu's */ + MenuType *mt; + IDProperty *prop_menu= NULL; + IDProperty *prop_menu_name= NULL; + /* only do it before bounding */ if(block->minx != block->maxx) return; + +#define UI_MENU_KEY_STR_CAT \ + char *butstr_orig= BLI_strdup(but->str); \ + BLI_snprintf(but->strdata, \ + sizeof(but->strdata), \ + "%s|%s", \ + butstr_orig, buf); \ + MEM_freeN(butstr_orig); \ + but->str= but->strdata; \ + ui_check_but(but); \ + + for(but=block->buttons.first; but; but=but->next) { if(but->optype) { - prop= (but->opptr)? but->opptr->data: NULL; + IDProperty *prop= (but->opptr)? but->opptr->data: NULL; - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - char *butstr_orig= BLI_strdup(but->str); - BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf); - MEM_freeN(butstr_orig); - but->str= but->strdata; - ui_check_but(but); + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { + UI_MENU_KEY_STR_CAT + } + } + else if ((mt= uiButGetMenuType(but))) { + /* only allocate menu property once */ + if (prop_menu == NULL) { + /* annoying, create a property */ + IDPropertyTemplate val = {0}; + prop_menu= IDP_New(IDP_GROUP, val, __func__); /* dummy, name is unimportant */ + IDP_AddToGroup(prop_menu, (prop_menu_name= IDP_NewString("", "name", sizeof(mt->idname)))); + } + + IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname)); + + if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE, buf, sizeof(buf))) { + UI_MENU_KEY_STR_CAT } } } + + if (prop_menu) { + IDP_FreeProperty(prop_menu); + MEM_freeN(prop_menu); + } + +#undef UI_MENU_KEY_STR_CAT + } void uiEndBlock(const bContext *C, uiBlock *block) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 7338aa1983f..ee1f9617813 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4357,7 +4357,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) IDProperty *prop= (but->opptr)? but->opptr->data: NULL; /* complex code to change name of button */ - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { char *butstr_orig; // XXX but->str changed... should not, remove the hotkey from it diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 32bcfe51afc..a6f93101fdc 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2821,3 +2821,14 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in } } } + +/* this is a bit of a hack but best keep it in one place at least */ +MenuType *uiButGetMenuType(uiBut *but) +{ + if(but->menu_create_func == ui_item_menutype_func) { + return (MenuType *)but->poin; + } + else { + return NULL; + } +} diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 34b62155314..837a9d12af1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -408,7 +408,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* operator keymap (not menus, they already have it) */ prop= (but->opptr)? but->opptr->data: NULL; - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; @@ -493,8 +493,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } else if (ELEM(but->type, MENU, PULLDOWN)) { if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) { - MenuType *mt= (MenuType *)but->poin; + MenuType *mt= uiButGetMenuType(but); + if (mt) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname); data->color[data->totline]= 0x888888; data->totline++; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 795446e76ef..eb7e06623f7 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2458,7 +2458,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char /* check for hotkey */ if(len < 256-6) { - if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1)) + if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1)) name[len]= '|'; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index aa407bbf6d4..c9fcb7f1d24 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -810,6 +810,11 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect) } +static int ui_but_draw_menu_icon(uiBut *but) +{ + return (but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP); +} + /* icons have been standardized... and this call draws in untransformed coordinates */ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect) @@ -888,8 +893,8 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect else UI_icon_draw_aspect(xs, ys, icon, aspect, alpha); } - - if((but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP)) { + + if (ui_but_draw_menu_icon(but)) { xs= rect->xmax-17; ys= (rect->ymin+rect->ymax- height)/2; @@ -1139,7 +1144,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* part text right aligned */ if(cpoin) { fstyle->align= UI_STYLE_TEXT_RIGHT; - rect->xmax-=5; + rect->xmax -= ui_but_draw_menu_icon(but) ? UI_DPI_ICON_SIZE : 5; uiStyleFontDraw(fstyle, rect, cpoin+1); *cpoin= '|'; } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 8b55db27761..fcdb6d25083 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -233,7 +233,6 @@ void WM_operator_py_idname(char *to, const char *from); void WM_menutype_init(void); struct MenuType *WM_menutype_find(const char *idname, int quiet); int WM_menutype_add(struct MenuType* mt); -int WM_menutype_contains(struct MenuType* mt); void WM_menutype_freelink(struct MenuType* mt); void WM_menutype_free(void); diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 250752e661a..f254358e3cf 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -92,7 +92,7 @@ void WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *key const char *WM_key_event_string(short type); int WM_key_event_operator_id(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, int hotkey, struct wmKeyMap **keymap_r); -char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, char *str, int len); +char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const short sloppy, char *str, int len); #ifdef __cplusplus } diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 10c3735685c..c6c67e22bfd 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -175,26 +175,6 @@ int WM_menutype_add(MenuType* mt) return 1; } -/* inefficient but only used for tooltip code */ -int WM_menutype_contains(MenuType* mt) -{ - int found= FALSE; - - if(mt) { - GHashIterator *iter= BLI_ghashIterator_new(menutypes_hash); - - for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { - if(mt == BLI_ghashIterator_getValue(iter)) { - found= TRUE; - break; - } - } - BLI_ghashIterator_free(iter); - } - - return found; -} - void WM_menutype_freelink(MenuType* mt) { BLI_ghash_remove(menutypes_hash, mt->idname, NULL, (GHashValFreeFP)MEM_freeN); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 9957d24c7ab..2e191a5ab6d 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -852,19 +852,19 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op return found; } -static wmKeyMapItem *wm_keymap_item_find(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int hotkey, wmKeyMap **keymap_r) +static wmKeyMapItem *wm_keymap_item_find(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r) { wmKeyMapItem *found= wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, keymap_r); - if(!found) + if(!found && sloppy) found= wm_keymap_item_find_props(C, opname, opcontext, NULL, 0, hotkey, keymap_r); return found; } -char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, char *str, int len) +char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short sloppy, char *str, int len) { - wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, 0, NULL); + wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL); if(kmi) { WM_keymap_item_to_string(kmi, str, len); @@ -876,7 +876,7 @@ char *WM_key_event_operator_string(const bContext *C, const char *opname, int op int WM_key_event_operator_id(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int hotkey, wmKeyMap **keymap_r) { - wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, hotkey, keymap_r); + wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r); if(kmi) return kmi->id; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 4367a8b03ef..7fb6ba6e26b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1362,7 +1362,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons /* check for hotkey */ if(len < 256-6) { - if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1)) + if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1)) name[len]= '|'; } From 0b1066af8ed799500cb0ec470b99c3a3300e575b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 15:05:41 +0000 Subject: [PATCH 054/203] fix [#29251] Properties options={'SKIP_SAVE'} not working, patch attached patch from Domino Marama (domino) --- source/blender/python/intern/bpy_props.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 4dbaf5db4a4..2b71cdd4ffc 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -425,6 +425,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -503,6 +504,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -568,6 +570,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -648,6 +651,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -723,6 +727,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -811,6 +816,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -873,6 +879,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -1204,6 +1211,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -1301,6 +1309,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -1355,6 +1364,7 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject if (pyopts) { if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } RNA_def_property_duplicate_pointers(srna, prop); } From 5b5f776eae79811b7c807b4a7eabfc7727d764cf Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 14 Nov 2011 15:29:59 +0000 Subject: [PATCH 055/203] * Recommit of "a" BLENDER_VERSION_CHAR. --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index dd7285d36a8..7be1252b9c2 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -49,7 +49,7 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR +#define BLENDER_VERSION_CHAR a /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE beta From 49ccf975f25c11d217e6db462986998991383291 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Nov 2011 16:05:44 +0000 Subject: [PATCH 056/203] minor cleanup - use NULL rather then 0 for pointers - use static functions where possible - add own includes to ensure func's and their declarations don't get out of sync. --- source/blender/blenfont/intern/blf_lang.c | 2 + .../blender/blenfont/intern/blf_translation.c | 2 +- source/blender/blenkernel/BKE_blender.h | 2 + .../blender/blenkernel/intern/dynamicpaint.c | 2 +- .../blender/blenkernel/intern/mesh_validate.c | 2 +- source/blender/blenlib/intern/bpath.c | 6 +- source/blender/blenlib/intern/path_util.c | 2 +- source/blender/editors/interface/interface.c | 2 +- .../blender/editors/interface/interface_ops.c | 2 +- .../editors/object/object_constraint.c | 2 +- source/blender/editors/object/object_vgroup.c | 2 +- .../editors/physics/dynamicpaint_ops.c | 12 ++-- .../blender/editors/space_clip/clip_toolbar.c | 2 + .../blender/editors/space_info/info_stats.c | 2 +- source/blender/makesdna/intern/makesdna.c | 10 +-- source/blender/makesrna/intern/rna_context.c | 2 + source/blender/makesrna/intern/rna_nodetree.c | 68 ++++++++++--------- source/blender/makesrna/intern/rna_wm.c | 58 ++++++++-------- .../modifiers/intern/MOD_dynamicpaint.c | 16 ++--- source/blender/modifiers/intern/MOD_ocean.c | 20 +++--- source/blender/nodes/NOD_socket.h | 3 + .../nodes/node_composite_moviedistortion.c | 2 +- .../render/intern/source/shadeoutput.c | 2 + .../bad_level_call_stubs/stubs.c | 2 +- 24 files changed, 122 insertions(+), 103 deletions(-) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 3bce3878d72..e8c6ff76934 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -34,6 +34,8 @@ #include "BLF_api.h" +#include "BLF_translation.h" /* own include */ + #ifdef WITH_INTERNATIONAL #include diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index 8688249732f..fe14f5d4d1c 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -47,7 +47,7 @@ #include "DNA_userdef_types.h" /* For user settings. */ #ifdef WITH_INTERNATIONAL -const char unifont_filename[]="droidsans.ttf.gz"; +static const char unifont_filename[]="droidsans.ttf.gz"; static unsigned char *unifont_ttf= NULL; static int unifont_size= 0; diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 7be1252b9c2..34b674fcb4a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -53,6 +53,8 @@ extern "C" { /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE beta +extern char versionstr[]; /* from blender.c */ + struct ListBase; struct MemFile; struct bContext; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 13eb59695b9..532e6f797dd 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -317,7 +317,7 @@ static int surface_duplicateOutputExists(void *arg, const char *name) return 0; } -void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *basename, int output) +static void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *basename, int output) { char name[64]; BLI_strncpy(name, basename, sizeof(name)); /* in case basename is surface->name use a copy */ diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 0dac4b8cd80..ec24f72874d 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -331,7 +331,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh #undef PRINT -int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata, short do_verbose, const short do_fixes) +static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata, short do_verbose, const short do_fixes) { int vfixed= 0, efixed= 0, ffixed= 0; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index ce5927cf3cc..8ad6cfc7cdf 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -131,7 +131,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) { - BPathRemap_Data data= {0}; + BPathRemap_Data data= {NULL}; if(basedir[0] == '\0') { printf("%s: basedir='', this is a bug\n", __func__); @@ -174,7 +174,7 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char /* similar to makeFilesRelative - keep in sync! */ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) { - BPathRemap_Data data= {0}; + BPathRemap_Data data= {NULL}; if(basedir[0] == '\0') { printf("%s: basedir='', this is a bug\n", __func__); @@ -280,7 +280,7 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports) { - struct BPathFind_Data data= {0}; + struct BPathFind_Data data= {NULL}; data.reports= reports; BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir)); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 7aa84523e9d..7c7d51e5907 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1841,7 +1841,7 @@ const char *BLI_program_dir(void) * @param fullname The full path to the temp directory * @param userdir Directory specified in user preferences */ -void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) +static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) { fullname[0] = '\0'; diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ce4e052bd53..be8bee7452d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3582,7 +3582,7 @@ void UI_init_userdef(void) uiStyleInit(); } -void UI_reinit_font() +void UI_reinit_font(void) { uiStyleInit(); } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 5803054caa7..2a75c2a26c1 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -494,7 +494,7 @@ struct uiEditSourceButStore { } uiEditSourceButStore; /* should only ever be set while the edit source operator is running */ -struct uiEditSourceStore *ui_editsource_info= NULL; +static struct uiEditSourceStore *ui_editsource_info= NULL; int UI_editsource_enable_check(void) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 0fbf5a8bd92..3c84b2df1d2 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -736,7 +736,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) where_is_pose(scene, ob); } else if (ob) { - Object workob = {{0}}; + Object workob = {{NULL}}; /* use what_does_parent to find inverse - just like for normal parenting */ what_does_parent(scene, ob, &workob); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 0d210fa83eb..936da90e8b7 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -799,7 +799,7 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count) } } if(!length) { - return 0; + return NULL; } tverts = MEM_mallocN(sizeof(int)*length, "tempSurroundingVerts"); mf = me->mface; diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index f30ff9c08e9..6739e297309 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -53,9 +53,11 @@ #include "WM_types.h" #include "WM_api.h" +#include "physics_intern.h" /* own include */ + static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { - DynamicPaintModifierData *pmd = 0; + DynamicPaintModifierData *pmd = NULL; Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; @@ -97,7 +99,7 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot) static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - DynamicPaintModifierData *pmd = 0; + DynamicPaintModifierData *pmd = NULL; Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; @@ -336,9 +338,9 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf /* -* Bake Dynamic Paint image sequence surface -*/ -int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op) + * Bake Dynamic Paint image sequence surface + */ +static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op) { DynamicPaintModifierData *pmd = NULL; DynamicPaintCanvasSettings *canvas; diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index c8113c5ea7b..fe09c5cd829 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -50,6 +50,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "clip_intern.h" /* own include */ + /* ************************ header area region *********************** */ /************************** properties ******************************/ diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 25e1d2f2816..52e6a8808ae 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -40,6 +40,7 @@ #include "BLI_utildefines.h" #include "BKE_anim.h" +#include "BKE_blender.h" #include "BKE_curve.h" #include "BKE_displist.h" #include "BKE_DerivedMesh.h" @@ -362,7 +363,6 @@ static void stats_update(Scene *scene) static void stats_string(Scene *scene) { - extern char versionstr[]; /* from blender.c */ SceneStats *stats= scene->stats; Object *ob= (scene->basact)? scene->basact->object: NULL; uintptr_t mem_in_use, mmap_in_use; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index c060eb186c9..ebd51d1c102 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -64,7 +64,7 @@ /* Included the path relative from /source/blender/ here, so we can move */ /* headers around with more freedom. */ -const char *includefiles[] = { +static const char *includefiles[] = { // if you add files here, please add them at the end // of makesdna.c (this file) as well @@ -224,7 +224,7 @@ void printStructLenghts(void); /* ************************* MAKEN DNA ********************** */ -int add_type(const char *str, int len) +static int add_type(const char *str, int len) { int nr; char *cp; @@ -399,7 +399,7 @@ static int add_name(const char *str) return nr_names-1; } -short *add_struct(int namecode) +static short *add_struct(int namecode) { int len; short *sp; @@ -522,7 +522,7 @@ static void *read_file_data(char *filename, int *len_r) return data; } -int convert_include(char *filename) +static int convert_include(char *filename) { /* read include file, skip structs with a '#' before it. store all data in temporal arrays. @@ -659,7 +659,7 @@ int convert_include(char *filename) return 0; } -int arraysize(char *astr, int len) +static int arraysize(char *astr, int len) { int a, mul=1; char str[100], *cp=NULL; diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index f041d3efde4..043645aaf57 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -35,6 +35,8 @@ #include "BKE_context.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME static PointerRNA rna_Context_manager_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 35ba9984c79..170cfcb103e 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -70,43 +70,43 @@ EnumPropertyItem node_socket_type_items[] = { {0, NULL, 0, NULL, NULL}}; EnumPropertyItem node_math_items[] = { -{ 0, "ADD", 0, "Add", ""}, -{ 1, "SUBTRACT", 0, "Subtract", ""}, -{ 2, "MULTIPLY", 0, "Multiply", ""}, -{ 3, "DIVIDE", 0, "Divide", ""}, -{ 4, "SINE", 0, "Sine", ""}, -{ 5, "COSINE", 0, "Cosine", ""}, -{ 6, "TANGENT", 0, "Tangent", ""}, -{ 7, "ARCSINE", 0, "Arcsine", ""}, -{ 8, "ARCCOSINE", 0, "Arccosine", ""}, -{ 9, "ARCTANGENT", 0, "Arctangent", ""}, -{10, "POWER", 0, "Power", ""}, -{11, "LOGARITHM", 0, "Logarithm", ""}, -{12, "MINIMUM", 0, "Minimum", ""}, -{13, "MAXIMUM", 0, "Maximum", ""}, -{14, "ROUND", 0, "Round", ""}, -{15, "LESS_THAN", 0, "Less Than", ""}, -{16, "GREATER_THAN", 0, "Greater Than", ""}, -{0, NULL, 0, NULL, NULL}}; + { 0, "ADD", 0, "Add", ""}, + { 1, "SUBTRACT", 0, "Subtract", ""}, + { 2, "MULTIPLY", 0, "Multiply", ""}, + { 3, "DIVIDE", 0, "Divide", ""}, + { 4, "SINE", 0, "Sine", ""}, + { 5, "COSINE", 0, "Cosine", ""}, + { 6, "TANGENT", 0, "Tangent", ""}, + { 7, "ARCSINE", 0, "Arcsine", ""}, + { 8, "ARCCOSINE", 0, "Arccosine", ""}, + { 9, "ARCTANGENT", 0, "Arctangent", ""}, + {10, "POWER", 0, "Power", ""}, + {11, "LOGARITHM", 0, "Logarithm", ""}, + {12, "MINIMUM", 0, "Minimum", ""}, + {13, "MAXIMUM", 0, "Maximum", ""}, + {14, "ROUND", 0, "Round", ""}, + {15, "LESS_THAN", 0, "Less Than", ""}, + {16, "GREATER_THAN", 0, "Greater Than", ""}, + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem node_vec_math_items[] = { -{0, "ADD", 0, "Add", ""}, -{1, "SUBTRACT", 0, "Subtract", ""}, -{2, "AVERAGE", 0, "Average", ""}, -{3, "DOT_PRODUCT", 0, "Dot Product", ""}, -{4, "CROSS_PRODUCT", 0, "Cross Product", ""}, -{5, "NORMALIZE", 0, "Normalize", ""}, -{0, NULL, 0, NULL, NULL}}; + {0, "ADD", 0, "Add", ""}, + {1, "SUBTRACT", 0, "Subtract", ""}, + {2, "AVERAGE", 0, "Average", ""}, + {3, "DOT_PRODUCT", 0, "Dot Product", ""}, + {4, "CROSS_PRODUCT", 0, "Cross Product", ""}, + {5, "NORMALIZE", 0, "Normalize", ""}, + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem node_filter_items[] = { -{0, "SOFTEN", 0, "Soften", ""}, -{1, "SHARPEN", 0, "Sharpen", ""}, -{2, "LAPLACE", 0, "Laplace", ""}, -{3, "SOBEL", 0, "Sobel", ""}, -{4, "PREWITT", 0, "Prewitt", ""}, -{5, "KIRSCH", 0, "Kirsch", ""}, -{6, "SHADOW", 0, "Shadow", ""}, -{0, NULL, 0, NULL, NULL}}; + {0, "SOFTEN", 0, "Soften", ""}, + {1, "SHARPEN", 0, "Sharpen", ""}, + {2, "LAPLACE", 0, "Laplace", ""}, + {3, "SOBEL", 0, "Sobel", ""}, + {4, "PREWITT", 0, "Prewitt", ""}, + {5, "KIRSCH", 0, "Kirsch", ""}, + {6, "SHADOW", 0, "Shadow", ""}, + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem prop_noise_basis_items[] = { {SHD_NOISE_PERLIN, "PERLIN", 0, "Perlin", ""}, @@ -124,11 +124,13 @@ EnumPropertyItem prop_noise_type_items[] = { {SHD_NOISE_HARD, "HARD", 0, "Hard", ""}, {0, NULL, 0, NULL, NULL}}; +#if 0 EnumPropertyItem prop_wave_items[] = { {SHD_WAVE_SINE, "SINE", 0, "Sine", "Uses a sine wave to produce bands"}, {SHD_WAVE_SAW, "SAW", 0, "Saw", "Uses a saw wave to produce bands"}, {SHD_WAVE_TRI, "TRI", 0, "Tri", "Uses a triangle wave to produce bands"}, {0, NULL, 0, NULL, NULL}}; +#endif /* Add any new socket value subtype here. * When adding a new subtype here, make sure you also add it diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index dfbdafd7d18..77ae7095454 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -338,41 +338,43 @@ EnumPropertyItem keymap_propvalue_items[] = { {0, "NONE", 0, "", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem keymap_modifiers_items[] = { - {KM_ANY, "ANY", 0, "Any", ""}, - {0, "NONE", 0, "None", ""}, - {1, "FIRST", 0, "First", ""}, - {2, "SECOND", 0, "Second", ""}, - {0, NULL, 0, NULL, NULL}}; +#if 0 +static EnumPropertyItem keymap_modifiers_items[] = { + {KM_ANY, "ANY", 0, "Any", ""}, + {0, "NONE", 0, "None", ""}, + {1, "FIRST", 0, "First", ""}, + {2, "SECOND", 0, "Second", ""}, + {0, NULL, 0, NULL, NULL}}; +#endif EnumPropertyItem operator_flag_items[] = { - {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"}, - {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, - {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"}, - {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"}, - {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"}, - {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"}, - {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"}, - {0, NULL, 0, NULL, NULL}}; + {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"}, + {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, + {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"}, + {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"}, + {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"}, + {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"}, + {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"}, + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_return_items[] = { - {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"}, - {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"}, - {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"}, - {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag - {0, NULL, 0, NULL, NULL}}; + {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"}, + {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"}, + {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"}, + {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag + {0, NULL, 0, NULL, NULL}}; /* flag/enum */ EnumPropertyItem wm_report_items[] = { - {RPT_DEBUG, "DEBUG", 0, "Debug", ""}, - {RPT_INFO, "INFO", 0, "Info", ""}, - {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""}, - {RPT_WARNING, "WARNING", 0, "Warning", ""}, - {RPT_ERROR, "ERROR", 0, "Error", ""}, - {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},\ - {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""}, - {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, - {0, NULL, 0, NULL, NULL}}; + {RPT_DEBUG, "DEBUG", 0, "Debug", ""}, + {RPT_INFO, "INFO", 0, "Info", ""}, + {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""}, + {RPT_WARNING, "WARNING", 0, "Warning", ""}, + {RPT_ERROR, "ERROR", 0, "Error", ""}, + {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},\ + {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""}, + {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, + {0, NULL, 0, NULL, NULL}}; #define KMI_TYPE_KEYBOARD 0 #define KMI_TYPE_MOUSE 1 diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index c6b9e5752e0..29ff5975e85 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -161,20 +161,20 @@ ModifierTypeInfo modifierType_DynamicPaint = { | eModifierTypeFlag_Single, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, - /* isDisabled */ 0, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 9cc2d367d66..e0ccb1f908e 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -542,19 +542,19 @@ ModifierTypeInfo modifierType_Ocean = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformMatrices */ 0, - /* deformVerts */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformMatrices */ NULL, + /* deformVerts */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h index 22efc99dfe8..6a6413d508f 100644 --- a/source/blender/nodes/NOD_socket.h +++ b/source/blender/nodes/NOD_socket.h @@ -62,6 +62,9 @@ struct bNodeSocket *nodeAddOutputVector(struct bNodeTree *ntree, struct bNode *n struct bNodeSocket *nodeAddInputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name, float r, float g, float b, float a); struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name); +struct bNodeSocket *nodeAddInputShader(struct bNodeTree *ntree, struct bNode *node, const char *name); +struct bNodeSocket *nodeAddOutputShader(struct bNodeTree *ntree, struct bNode *node, const char *name); + struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name); struct bNodeSocket *nodeAddOutputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name); diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index 8411de39353..05d13f346f3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -118,7 +118,7 @@ static void storage_free(bNode *node) node->storage= NULL; } -void storage_copy(bNode *orig_node, bNode *new_node) +static void storage_copy(bNode *orig_node, bNode *new_node) { if(orig_node->storage) new_node->storage= BKE_tracking_distortion_copy(orig_node->storage); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index e1f521db066..b58a6695fd6 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -55,6 +55,8 @@ #include "sss.h" #include "texture.h" +#include "shading.h" /* own include */ + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* defined in pipeline.c, is hardcopy of active dynamic allocated Render */ /* only to be used here in this file, it's for speed */ diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 48dcf8a1c7f..abc5307b9f6 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -351,7 +351,7 @@ void uiItemS(struct uiLayout *layout){} void uiItemFullR(struct uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, char *name, int icon){} void uiLayoutSetContextPointer(struct uiLayout *layout, char *name, struct PointerRNA *ptr){} char *uiLayoutIntrospect(struct uiLayout *layout){return (char *)NULL;} -void UI_reinit_font() {} +void UI_reinit_font(void) {} /* rna template */ void uiTemplateAnyID(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *text){} From 01549823960705bab986329a57a89c7907e07950 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 16:18:44 +0000 Subject: [PATCH 057/203] Object.to_mesh() for metaball objects now only return a mesh for the basis/mother metaball. This should fix duplicated export of metaballs for python exporters and cycles. --- source/blender/makesrna/intern/rna_object_api.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index c4508c718e5..5b8b9d9a6b2 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -128,16 +128,20 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ free_libblock_us( &G.main->object, tmpobj ); break; - case OB_MBALL: + case OB_MBALL: { /* metaballs don't have modifiers, so just convert to mesh */ - ob = find_basis_mball( sce, ob ); + Object *basis_ob = find_basis_mball( sce, ob ); /* todo, re-generatre for render-res */ /* metaball_polygonize(scene, ob) */ + if(ob != basis_ob) + return NULL; /* only do basis metaball */ + tmpmesh = add_mesh("Mesh"); mball_to_mesh( &ob->disp, tmpmesh ); break; + } case OB_MESH: /* copies object and modifiers (but not the data) */ if (cage) { From 90871d54c59be6eb66cd086c1387786526595f1f Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Mon, 14 Nov 2011 16:34:11 +0000 Subject: [PATCH 058/203] Fix: Last triangle wasn't always drawn when VBO enabled. --- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 1e38f666da7..0f9033ca461 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -945,7 +945,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us } if(setDrawOptions == NULL) { /* just draw the entire face array */ - glDrawArrays(GL_TRIANGLES, 0, (tottri-1) * 3); + glDrawArrays(GL_TRIANGLES, 0, (tottri) * 3); } else { /* we need to check if the next material changes */ From e731ffb64884e1e74b4736538533698dee1e21a7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 17:31:47 +0000 Subject: [PATCH 059/203] Cycles: Oren-Nayar BSDF support. This is not a separate shader node, rather it is available through the Roughness input on the Diffuse BSDF. http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#Diffuse Patch by Yasuhiro Fujii, thanks! --- intern/cycles/kernel/CMakeLists.txt | 1 + intern/cycles/kernel/osl/CMakeLists.txt | 1 + intern/cycles/kernel/osl/bsdf_oren_nayar.cpp | 174 ++ .../kernel/osl/nodes/node_diffuse_bsdf.osl | 6 +- intern/cycles/kernel/osl/nodes/stdosl.h | 1 + intern/cycles/kernel/osl/osl_closures.cpp | 1 + intern/cycles/kernel/osl/osl_closures.h | 3 + intern/cycles/kernel/svm/bsdf_oren_nayar.h | 143 + intern/cycles/kernel/svm/svm_bsdf.h | 13 + intern/cycles/kernel/svm/svm_closure.h | 7 +- intern/cycles/kernel/svm/svm_types.h | 1 + intern/cycles/render/nodes.cpp | 3 +- .../gpu/intern/gpu_shader_material.glsl | 19 +- .../gpu/intern/gpu_shader_material.glsl.c | 2598 +++++++++-------- .../shader/nodes/node_shader_bsdf_diffuse.c | 1 + 15 files changed, 1667 insertions(+), 1305 deletions(-) create mode 100644 intern/cycles/kernel/osl/bsdf_oren_nayar.cpp create mode 100644 intern/cycles/kernel/svm/bsdf_oren_nayar.h diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 614391bd3f2..2bfb6c58120 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -42,6 +42,7 @@ set(SRC_SVM_HEADERS svm/bsdf.h svm/bsdf_ashikhmin_velvet.h svm/bsdf_diffuse.h + svm/bsdf_oren_nayar.h svm/bsdf_microfacet.h svm/bsdf_reflection.h svm/bsdf_refraction.h diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt index ae88008cf71..13b2a39d7d0 100644 --- a/intern/cycles/kernel/osl/CMakeLists.txt +++ b/intern/cycles/kernel/osl/CMakeLists.txt @@ -12,6 +12,7 @@ set(SRC background.cpp bsdf_ashikhmin_velvet.cpp bsdf_diffuse.cpp + bsdf_oren_nayar.cpp bsdf_microfacet.cpp bsdf_reflection.cpp bsdf_refraction.cpp diff --git a/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp b/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp new file mode 100644 index 00000000000..a42c81e78f3 --- /dev/null +++ b/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp @@ -0,0 +1,174 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * An implementation of Oren-Nayar reflectance model, public domain + * http://www1.cs.columbia.edu/CAVE/publications/pdfs/Oren_SIGGRAPH94.pdf + * + * NOTE: + * BSDF = A + B * cos() * sin() * tan() + * + * The parameter sigma means different from original. + * A and B are calculated by the following formula: + * 0 <= sigma <= 1 + * A = 1 / ((1 + sigma / 2) * pi); + * B = sigma / ((1 + sigma / 2) * pi); + * + * This formula is derived as following: + * + * 0. Normalize A-term and B-term of BSDF *individually*. + * B-term is normalized at maximum point: dot(L, N) = 0. + * A = (1/pi) * A' + * B = (2/pi) * B' + * + * 1. Solve the following equation: + * A' + B' = 1 + * B / A = sigma + */ + +#include +#include +#include "osl_closures.h" + +CCL_NAMESPACE_BEGIN + +using namespace OSL; + + +class OrenNayarClosure: public BSDFClosure { +public: + Vec3 m_N; + float m_sigma; + float m_a, m_b; + + OrenNayarClosure(): BSDFClosure(Labels::DIFFUSE) {} + + void setup() { + m_sigma = clamp(m_sigma, 0.0f, 1.0f); + m_a = 1.0f / ((1.0f + 0.5f * m_sigma) * M_PI); + m_b = m_sigma / ((1.0f + 0.5f * m_sigma) * M_PI); + } + + bool mergeable(const ClosurePrimitive* other) const { + const OrenNayarClosure* comp = static_cast(other); + return + m_N == comp->m_N && + m_sigma == comp->m_sigma && + BSDFClosure::mergeable(other); + } + + size_t memsize() const { + return sizeof(*this); + } + + const char* name() const { + return "oren_nayar"; + } + + void print_on(std::ostream& out) const { + out << name() << " ("; + out << "(" << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), "; + out << m_sigma; + out << ")"; + } + + float albedo(const Vec3& omega_out) const { + return 1.0f; + } + + Color3 eval_reflect(const Vec3& omega_out, const Vec3& omega_in, float& pdf) const { + if (m_N.dot(omega_in) > 0.0f) { + pdf = float(0.5 * M_1_PI); + float is = get_intensity(m_N, omega_out, omega_in); + return Color3(is, is, is); + } + else { + pdf = 0.0f; + return Color3(0.0f, 0.0f, 0.0f); + } + } + + Color3 eval_transmit(const Vec3& omega_out, const Vec3& omega_in, float& pdf) const { + return Color3(0.0f, 0.0f, 0.0f); + } + + ustring sample( + const Vec3& Ng, + const Vec3& omega_out, const Vec3& domega_out_dx, const Vec3& domega_out_dy, + float randu, float randv, + Vec3& omega_in, Vec3& domega_in_dx, Vec3& domega_in_dy, + float& pdf, Color3& eval + ) const { + sample_uniform_hemisphere (m_N, omega_out, randu, randv, omega_in, pdf); + + if (Ng.dot(omega_in) > 0.0f) { + float is = get_intensity(m_N, omega_out, omega_in); + eval.setValue(is, is, is); + + // TODO: find a better approximation for the bounce + domega_in_dx = (2.0f * m_N.dot(domega_out_dx)) * m_N - domega_out_dx; + domega_in_dy = (2.0f * m_N.dot(domega_out_dy)) * m_N - domega_out_dy; + domega_in_dx *= 125.0f; + domega_in_dy *= 125.0f; + } + else { + pdf = 0.0f; + } + + return Labels::REFLECT; + } + +private: + float get_intensity(Vec3 const& n, Vec3 const& v, Vec3 const& l) const { + float nl = max(n.dot(l), 0.0f); + float nv = max(n.dot(v), 0.0f); + + Vec3 al = l - nl * n; + al.normalize(); + Vec3 av = v - nv * n; + av.normalize(); + float t = max(al.dot(av), 0.0f); + + float cos_a, cos_b; + if (nl < nv) { + cos_a = nl; + cos_b = nv; + } + else { + cos_a = nv; + cos_b = nl; + } + + float sin_a = sqrtf(1.0f - cos_a * cos_a); + float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN); + + return nl * (m_a + m_b * t * sin_a * tan_b); + } +}; + +ClosureParam bsdf_oren_nayar_params[] = { + CLOSURE_VECTOR_PARAM (OrenNayarClosure, m_N), + CLOSURE_FLOAT_PARAM (OrenNayarClosure, m_sigma), + CLOSURE_STRING_KEYPARAM ("label"), + CLOSURE_FINISH_PARAM (OrenNayarClosure) +}; + +CLOSURE_PREPARE(bsdf_oren_nayar_prepare, OrenNayarClosure) + + +CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl index 8cf161c17cc..6075b7c93f3 100644 --- a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl +++ b/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl @@ -20,9 +20,13 @@ shader node_diffuse_bsdf( color Color = color(0.8, 0.8, 0.8), + float Roughness = 0.0, normal Normal = N, output closure color BSDF = diffuse(Normal)) { - BSDF = Color*diffuse(Normal); + if(Roughness == 0.0) + BSDF = Color * diffuse(Normal); + else + BSDF = Color * oren_nayar(Normal, Roughness); } diff --git a/intern/cycles/kernel/osl/nodes/stdosl.h b/intern/cycles/kernel/osl/nodes/stdosl.h index 6fe4f52df4a..e4a110e737c 100644 --- a/intern/cycles/kernel/osl/nodes/stdosl.h +++ b/intern/cycles/kernel/osl/nodes/stdosl.h @@ -435,6 +435,7 @@ string concat (string a, string b, string c, string d, string e, string f) { // Closures closure color diffuse(normal N) BUILTIN; +closure color oren_nayar(normal N, float sigma) BUILTIN; closure color translucent(normal N) BUILTIN; closure color reflection(normal N, float eta) BUILTIN; closure color reflection(normal N) { return reflection (N, 0.0); } diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 4c2261942fd..b87cdf8af86 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -69,6 +69,7 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O void OSLShader::register_closures(OSL::ShadingSystem *ss) { register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params, bsdf_diffuse_prepare); + register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params, bsdf_oren_nayar_prepare); register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params, bsdf_translucent_prepare); register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params, bsdf_reflection_prepare); register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params, bsdf_refraction_prepare); diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index 20a759586b0..1b4288b8601 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -41,6 +41,7 @@ CCL_NAMESPACE_BEGIN enum { OSL_CLOSURE_BSDF_DIFFUSE_ID, + OSL_CLOSURE_BSDF_OREN_NAYAR_ID, OSL_CLOSURE_BSDF_TRANSLUCENT_ID, OSL_CLOSURE_BSDF_REFLECTION_ID, OSL_CLOSURE_BSDF_REFRACTION_ID, @@ -62,6 +63,7 @@ enum { }; extern OSL::ClosureParam bsdf_diffuse_params[]; +extern OSL::ClosureParam bsdf_oren_nayar_params[]; extern OSL::ClosureParam bsdf_translucent_params[]; extern OSL::ClosureParam bsdf_reflection_params[]; extern OSL::ClosureParam bsdf_refraction_params[]; @@ -82,6 +84,7 @@ extern OSL::ClosureParam closure_holdout_params[]; extern OSL::ClosureParam closure_subsurface_params[]; void bsdf_diffuse_prepare(OSL::RendererServices *, int id, void *data); +void bsdf_oren_nayar_prepare(OSL::RendererServices *, int id, void *data); void bsdf_translucent_prepare(OSL::RendererServices *, int id, void *data); void bsdf_reflection_prepare(OSL::RendererServices *, int id, void *data); void bsdf_refraction_prepare(OSL::RendererServices *, int id, void *data); diff --git a/intern/cycles/kernel/svm/bsdf_oren_nayar.h b/intern/cycles/kernel/svm/bsdf_oren_nayar.h new file mode 100644 index 00000000000..9eefdffe6ae --- /dev/null +++ b/intern/cycles/kernel/svm/bsdf_oren_nayar.h @@ -0,0 +1,143 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * An implementation of Oren-Nayar reflectance model, public domain + * http://www1.cs.columbia.edu/CAVE/publications/pdfs/Oren_SIGGRAPH94.pdf + * + * NOTE: + * BSDF = A + B * cos() * sin() * tan() + * + * The parameter sigma means different from original. + * A and B are calculated by the following formula: + * 0 <= sigma <= 1 + * A = 1 / ((1 + sigma / 2) * pi); + * B = sigma / ((1 + sigma / 2) * pi); + * + * This formula is derived as following: + * + * 0. Normalize A-term and B-term of BSDF *individually*. + * B-term is normalized at maximum point: dot(L, N) = 0. + * A = (1/pi) * A' + * B = (2/pi) * B' + * + * 1. Solve the following equation: + * A' + B' = 1 + * B / A = sigma + */ + +#ifndef __BSDF_OREN_NAYAR_H__ +#define __BSDF_OREN_NAYAR_H__ + +CCL_NAMESPACE_BEGIN + +typedef struct BsdfOrenNayarClosure { + float m_a; + float m_b; +} BsdfOrenNayarClosure; + +__device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n, float3 v, float3 l) +{ + float nl = max(dot(n, l), 0.0f); + float nv = max(dot(n, v), 0.0f); + + float3 al = normalize(l - nl * n); + float3 av = normalize(v - nv * n); + float t = max(dot(al, av), 0.0f); + + float cos_a, cos_b; + if(nl < nv) { + cos_a = nl; + cos_b = nv; + } + else { + cos_a = nv; + cos_b = nl; + } + + float sin_a = sqrtf(1.0f - cos_a * cos_a); + float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN); + + float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b); + return make_float3(is, is, is); +} + +__device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sigma) +{ + sc->type = CLOSURE_BSDF_OREN_NAYAR_ID; + sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL; + + sigma = clamp(sigma, 0.0f, 1.0f); + + sc->data0 = 1.0f / ((1.0f + 0.5f * sigma) * M_PI); + sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI); +} + +__device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness) +{ +} + +__device float3 bsdf_oren_nayar_eval_reflect(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) +{ + if (dot(sd->N, omega_in) > 0.0f) { + *pdf = 0.5f * M_1_PI_F; + return bsdf_oren_nayar_get_intensity(sc, sd->N, I, omega_in); + } + else { + *pdf = 0.0f; + return make_float3(0.0f, 0.0f, 0.0f); + } +} + +__device float3 bsdf_oren_nayar_eval_transmit(const ShaderData *sd, const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) +{ + return make_float3(0.0f, 0.0f, 0.0f); +} + +__device float bsdf_oren_nayar_albedo(const ShaderData *sd, const ShaderClosure *sc, const float3 I) +{ + return 1.0f; +} + +__device int bsdf_oren_nayar_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf) +{ + sample_uniform_hemisphere(sd->N, randu, randv, omega_in, pdf); + + if (dot(sd->Ng, *omega_in) > 0.0f) { + *eval = bsdf_oren_nayar_get_intensity(sc, sd->N, sd->I, *omega_in); + +#ifdef __RAY_DIFFERENTIALS__ + // TODO: find a better approximation for the bounce + *domega_in_dx = (2.0f * dot(sd->N, sd->dI.dx)) * sd->N - sd->dI.dx; + *domega_in_dy = (2.0f * dot(sd->N, sd->dI.dy)) * sd->N - sd->dI.dy; + *domega_in_dx *= 125.0f; + *domega_in_dy *= 125.0f; +#endif + } + else { + *pdf = 0.0f; + *eval = make_float3(0.0f, 0.0f, 0.0f); + } + + return LABEL_REFLECT | LABEL_DIFFUSE; +} + + +CCL_NAMESPACE_END + +#endif /* __BSDF_OREN_NAYAR_H__ */ diff --git a/intern/cycles/kernel/svm/svm_bsdf.h b/intern/cycles/kernel/svm/svm_bsdf.h index 411efc8be8f..411916f8aa0 100644 --- a/intern/cycles/kernel/svm/svm_bsdf.h +++ b/intern/cycles/kernel/svm/svm_bsdf.h @@ -18,6 +18,7 @@ #include "bsdf_ashikhmin_velvet.h" #include "bsdf_diffuse.h" +#include "bsdf_oren_nayar.h" #include "bsdf_microfacet.h" #include "bsdf_reflection.h" #include "bsdf_refraction.h" @@ -38,6 +39,9 @@ __device int svm_bsdf_sample(const ShaderData *sd, const ShaderClosure *sc, floa label = bsdf_diffuse_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); break; #ifdef __SVM__ + case CLOSURE_BSDF_OREN_NAYAR_ID: + label = bsdf_oren_nayar_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); + break; case CLOSURE_BSDF_TRANSLUCENT_ID: label = bsdf_translucent_sample(sd, sc, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); break; @@ -91,6 +95,9 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con eval = bsdf_diffuse_eval_reflect(sd, sc, sd->I, omega_in, pdf); break; #ifdef __SVM__ + case CLOSURE_BSDF_OREN_NAYAR_ID: + eval = bsdf_oren_nayar_eval_reflect(sd, sc, sd->I, omega_in, pdf); + break; case CLOSURE_BSDF_TRANSLUCENT_ID: eval = bsdf_translucent_eval_reflect(sd, sc, sd->I, omega_in, pdf); break; @@ -137,6 +144,9 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con eval = bsdf_diffuse_eval_transmit(sd, sc, sd->I, omega_in, pdf); break; #ifdef __SVM__ + case CLOSURE_BSDF_OREN_NAYAR_ID: + eval = bsdf_oren_nayar_eval_transmit(sd, sc, sd->I, omega_in, pdf); + break; case CLOSURE_BSDF_TRANSLUCENT_ID: eval = bsdf_translucent_eval_transmit(sd, sc, sd->I, omega_in, pdf); break; @@ -188,6 +198,9 @@ __device void svm_bsdf_blur(ShaderClosure *sc, float roughness) bsdf_diffuse_blur(sc, roughness); break; #ifdef __SVM__ + case CLOSURE_BSDF_OREN_NAYAR_ID: + bsdf_oren_nayar_blur(sc, roughness); + break; case CLOSURE_BSDF_TRANSLUCENT_ID: bsdf_translucent_blur(sc, roughness); break; diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index fcda7ac6fe1..8409e83d94e 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -80,7 +80,12 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st case CLOSURE_BSDF_DIFFUSE_ID: { ShaderClosure *sc = svm_node_closure_get(sd); svm_node_closure_set_mix_weight(sc, mix_weight); - bsdf_diffuse_setup(sd, sc); + + float roughness = param1; + if(roughness == 0.0f) + bsdf_diffuse_setup(sd, sc); + else + bsdf_oren_nayar_setup(sd, sc, roughness); break; } case CLOSURE_BSDF_TRANSLUCENT_ID: { diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 89fc413c539..071477a83c7 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -258,6 +258,7 @@ typedef enum ShaderType { typedef enum ClosureType { CLOSURE_BSDF_ID, CLOSURE_BSDF_DIFFUSE_ID, + CLOSURE_BSDF_OREN_NAYAR_ID, CLOSURE_BSDF_TRANSLUCENT_ID, CLOSURE_BSDF_REFLECTION_ID, CLOSURE_BSDF_REFRACTION_ID, diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index f934b703103..d7bd74c9ec7 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1003,11 +1003,12 @@ void VelvetBsdfNode::compile(OSLCompiler& compiler) DiffuseBsdfNode::DiffuseBsdfNode() { closure = CLOSURE_BSDF_DIFFUSE_ID; + add_input("Roughness", SHADER_SOCKET_FLOAT, 0.0f); } void DiffuseBsdfNode::compile(SVMCompiler& compiler) { - BsdfNode::compile(compiler, NULL, NULL); + BsdfNode::compile(compiler, input("Roughness"), NULL); } void DiffuseBsdfNode::compile(OSLCompiler& compiler) diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 0c24b4d7c7e..5aaf99bdd24 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -1837,7 +1837,7 @@ float hypot(float x, float y) /* bsdfs */ -void node_bsdf_diffuse(vec4 color, vec3 N, out vec4 result) +void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result) { /* ambient light */ vec3 L = vec3(0.2); @@ -1856,14 +1856,19 @@ void node_bsdf_diffuse(vec4 color, vec3 N, out vec4 result) void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 result) { - vec3 L = vec3(0.0); + /* ambient light */ + vec3 L = vec3(0.2); /* directional lights */ for(int i = 0; i < NUM_LIGHTS; i++) { + vec3 light_position = gl_LightSource[i].position.xyz; vec3 H = gl_LightSource[i].halfVector.xyz; + vec3 light_diffuse = gl_LightSource[i].diffuse.rgb; vec3 light_specular = gl_LightSource[i].specular.rgb; - float bsdf = pow(max(dot(N, H), 0.0), 1.0/roughness); + /* we mix in some diffuse so low roughness still shows up */ + float bsdf = 0.5*pow(max(dot(N, H), 0.0), 1.0/roughness); + bsdf += 0.5*max(dot(N, light_position), 0.0); L += light_specular*bsdf; } @@ -1872,17 +1877,17 @@ void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 resu void node_bsdf_anisotropic(vec4 color, float roughnessU, float roughnessV, vec3 N, vec3 I, out vec4 result) { - node_bsdf_diffuse(color, N, result); + node_bsdf_diffuse(color, 0.0, N, result); } void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, vec3 I, out vec4 result) { - node_bsdf_diffuse(color, N, result); + node_bsdf_diffuse(color, 0.0, N, result); } void node_bsdf_translucent(vec4 color, vec3 N, out vec4 result) { - node_bsdf_diffuse(color, N, result); + node_bsdf_diffuse(color, 0.0, N, result); } void node_bsdf_transparent(vec4 color, out vec4 result) @@ -1896,7 +1901,7 @@ void node_bsdf_transparent(vec4 color, out vec4 result) void node_bsdf_velvet(vec4 color, float sigma, vec3 N, out vec4 result) { - node_bsdf_diffuse(color, N, result); + node_bsdf_diffuse(color, 0.0, N, result); } /* emission */ diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index f64152a200a..493c32d5a45 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,1326 +1,1334 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 46336; +int datatoc_gpu_shader_material_glsl_size= 46619; char datatoc_gpu_shader_material_glsl[]= { - - 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114, -101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, - 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32, -104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, - 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, - 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, - 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109, -105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, - 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, - 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, - 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, - 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46, -120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, - 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, - 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, - 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, - 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, - 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, - 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118, -101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, - 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, - 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, - 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114, -103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, - 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, - 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, - 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, - 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, - 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, - 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32, -112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118, -101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, - 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105, -102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, - 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, - 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, - 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32, -104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114, -103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, - 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, - 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, - 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108, -111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, - 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, - 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9, -114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, - 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, - 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, - 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, - 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95, -116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116, -111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, - 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, -118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95, -102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, - 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, -114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, - 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97, -114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116, -111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, - 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, - 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, - 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111, -108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111, -108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117, -118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116, -117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, - 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, - 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99, -111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118, -105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, - 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46, -120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98, -117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97, -108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114, -109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116, -101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, - 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, -118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, - 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, - 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, -116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, - 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10, - 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10, - 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, - 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, - 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105,115, -116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, 10, 9,111,117,116, -100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, 32, 61, 32,110,111, -114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108, + 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, + 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111, +117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99, +109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, + 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32, +114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105, +110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, + 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, + 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, + 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, + 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, + 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, + 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, + 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, + 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, + 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, + 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, + 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, +104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95, +114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, + 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, + 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115, +118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32, +123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115, +101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, + 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, + 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, + 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, + 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, + 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, + 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, + 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, + 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101, +108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32, +113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, + 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, + 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, +114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105, +110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, + 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, + 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, + 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10, +125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, + 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114, +110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108, +115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, + 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110, +101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99, +111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110, +101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32, +115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, + 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, + 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, + 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, + 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99, +111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95, +102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116, +111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, + 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110, +101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 35,100, +101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, + 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116, +101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, + 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97, +116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, + 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, + 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, + 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, + 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110, +111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99, +111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,112,104, 97, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99, +111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108, +111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, + 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97, +116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45, +110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101, +114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116, +114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,118, 99,111,108, 95, 97,108,112, +104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, + 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32, +102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, + 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, + 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118, +101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, + 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, + 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, + 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, + 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, +100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32, +118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97, +116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, +116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, + 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, + 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, +109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97, +108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, + 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, + 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, +109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97, +108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, + 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, + 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108, +111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, + 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111, +117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97, +108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, + 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, + 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, + 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, + 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97, +108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, + 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, + 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, +118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108, 111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, - 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, - 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105, -100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, -100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, - 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, -115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, - 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,116, 97,110, - 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108,111, 97,116, 32,118, - 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, - 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, - 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, - 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, 32,118, 97,108, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, - 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, - 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, - 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 97,116, 97,110, - 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97, -108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, - 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, - 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, - 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108,111, 97,116, 32,118, - 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, - 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, 40, -118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, - 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, - 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, - 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109,105,110, 40,118, - 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111,117,110,100, 40,102, -108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40, -118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108, -115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, -103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, - 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, - 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, - 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117,101,101,122,101, 40, -102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, 97,116, 32, 99,101, -110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, -108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, - 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111, -117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, - 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, - 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, - 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, - 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, - 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, - 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105, -100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, +111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, + 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32, +108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, + 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, +111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, +117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, + 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, +109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111, +117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, + 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, + 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, + 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32, +109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, +111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105, +102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9, +101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117, +101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, + 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, +111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, + 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32, +118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116, +118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118, +101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, + 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117, -116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, - 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95, -109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, - 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111,117,116,118, 97,108, - 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, - 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, +111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117, +116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116, +118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, + 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, + 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, + 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116, +118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111, +117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, + 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116, +118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, + 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, - 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116, -104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, -118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, - 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122, -101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97,116,101, 40,118,101, - 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116,118, 32, 61, 32, 45, -118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, 51, - 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9,111,117,116,100,111, -116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118, -101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112, -108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, - 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97, -112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, - 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, - 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, - 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101, -109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, - 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, - 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, - 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, - 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32, -111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116, -101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, - 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, - 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, - 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97, -112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, - 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, - 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99, -111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46, 98, 59, 10, 10, 9,105,102, 32, 40,102, 97, - 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, - 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, - 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, - 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, -108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111, -108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, - 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32, -111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, - 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117,116, 32,102,108,111, - 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, - 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, - 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, -116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, - 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, - 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,108,101,110, -100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, - 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97, -109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, - 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99, -111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108,111, 97,116, 32,102, 97, 99, - 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, - 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, - 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, - 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, - 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, -101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, -116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, - 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, - 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, -125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, +117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114, +109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97, +116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116, +118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, + 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9, +111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, + 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, + 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117, +114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, + 48, 46, 48, 41, 41, 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99, +117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, + 32, 48, 46, 48, 41, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, + 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, + 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111, +117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, + 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97, +116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101, +109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46, +114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120, +116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,114, 44, 32, 48, 46, 48, + 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117, +114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117, +114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, + 41, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118, +101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118, +101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46, 98, 59, 10, 10, 9,105, +102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111, +108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99, +111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40, +102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, +111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, + 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, +111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, + 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, + 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117, +116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, + 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, + 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115, +101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, + 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, + 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, + 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, + 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, + 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, + 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108,111, 97, +116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, + 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, + 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, + 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, + 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, 32,102, + 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, + 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111, +108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, + 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,102, 97, + 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, + 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, + 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, + 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, + 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40, +118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99, +111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, 97,116, + 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, + 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32, +102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111, +108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, + 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, + 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, + 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40, +111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32,102, 97, + 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, + 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, + 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, + 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, + 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115,101, 10, + 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, + 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, + 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32, +118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, +117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, + 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 45, + 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, + 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, + 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111, +108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, + 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, + 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32, +111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, 42,111, +117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, + 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, + 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, + 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, + 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,105, +120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, + 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, + 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, + 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, + 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, +109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118, +101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, + 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111, +108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, + 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, + 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, + 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9, +102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, + 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, + 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111, +105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, + 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, + 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111, +117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, 32, 48, + 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111, +108, 50, 46,114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, + 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111, +108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, + 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, + 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116, +109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109,112, 32, + 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115, +101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, + 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117, +116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 33, 61, + 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, + 99,111,108, 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99, +111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, + 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, + 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10, 9, +125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, - 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111, -117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, 97, 99,109, 41, 32, - 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, - 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, - 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, 97,116, 32,102, 97, 99, 44, - 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32, -111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, - 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, - 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, - 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, - 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, - 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, -114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111, -108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, - 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, - 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, - 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40, -111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, - 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, - 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, - 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10, -125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, - 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, - 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, - 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, - 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118, -111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, - 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, - 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108, -111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, - 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111, -108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, - 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117, -116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99, 42,111,117,116, - 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, - 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99, 42, -111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,102, -102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, - 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97, -109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, - 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, 10, 9, -111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, - 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, -111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, -108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, - 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, - 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, -108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, - 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, - 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114, -103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, - 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105, -120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, - 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, - 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, - 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, - 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, - 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, - 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,114, 47,116, -109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9, -101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111, -117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, - 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, - 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, - 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111, -117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, -103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, - 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, - 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, - 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46, 98, - 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, - 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10, -118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111, -108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, -123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9, -102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111, -117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, - 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111, -108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, - 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, - 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, - 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9, -111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, - 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, - 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, - 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, - 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, - 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, - 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, - 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111, -117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, - 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, - 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116, -109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115, -101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, -104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, -111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, -108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, - 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, - 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115, -118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, - 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, - 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104, -115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111, -108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, - 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, - 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32, -111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, - 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, - 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, - 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,105, -102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99, -111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46, -121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, - 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,118, 97,108, 40,102,108, -111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, - 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, - 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116, -111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111, -108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,122, 32, - 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111, -117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32, -102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118, -101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, - 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, - 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, - 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115, -118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, - 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32, -104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95, -116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109, -105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, - 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,111,102,116, 40,102, + 48, 41, 59, 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, + 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, + 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, +111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, + 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, 60, 32, + 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, +116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108, +115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99, +109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, + 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, + 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, 41, 32, + 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105, +102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, +101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, + 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, + 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109, +112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109,112, 41, + 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, + 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, + 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111,105,100, + 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118, +101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, + 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, + 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111, +108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95, +116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, + 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104, +115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116,111, 95, +114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, +111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, + 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, 97,116, + 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, + 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32, +102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, + 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, + 59, 10, 10, 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95, +104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, 99,109, + 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, + 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,118, + 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111, +108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, + 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, + 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9, +114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, 95,104, +115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, 42,104, +115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104, +115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102, 108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32, 111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, - 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10, - 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99,111,108, 50, 41, 42, 40,111, -110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99,109, 42, 99,111,108, 49, 32, - 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, 99,111,108, 49, 32, 43, 32, - 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,110,101, 97,114, 40,102,108, -111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, - 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, - 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99, -111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, - 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, - 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, - 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, - 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, - 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111, -108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, - 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, - 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, - 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, - 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, - 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, -116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, 10,123, 10, 9,111,117,116, - 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,111,108,111,114,109, 97,112, 44, 32,118,101, 99, 50, 40,102, - 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10, 9,111,117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, - 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108, -111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, - 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, - 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10, -125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99, -111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120, -121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, - 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, - 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32, -104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, - 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111, -108, 41, 10,123, 10, 9,118,101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, - 44, 32,104,115,118, 41, 59, 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, - 10, 9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108, -115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, - 9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32, -104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, - 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, - 9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115, -101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9, -104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111, -108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, - 10,123, 10, 9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, - 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, - 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99, -111,108, 41, 10,123, 10, 9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, - 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102, -108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9, -111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, - 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110, -100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9, -111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114, -101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, - 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40, -118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, - 41, 59, 10, 9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101, -120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, - 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118, -101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, - 53, 42,115,105,110, 40, 97, 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, - 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, - 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116, -101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, - 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, - 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, - 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, - 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, - 10, 9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, - 59, 10, 9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, - 41, 59, 10, 9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, - 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118, -101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111, -114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40, -118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100, -105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32, -119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, - 10, 9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, - 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97, -116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118, -101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10, -123, 10, 9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119, -104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111, -117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111, -117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, - 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110, -103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118, -109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, - 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, - 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40, -109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32, -118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106, -101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, - 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114, -101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, - 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118, -101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10, -123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110, -101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122, -101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110, -100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, + 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, + 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, + 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, + 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, + 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, 10, 9, + 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111, +108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, + 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, +111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, +111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, +108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, + 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, 40, 49, + 46, 48, 41, 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99,111,108, + 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99,109, 42, + 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, 99,111, +108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,110,101, + 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111, +108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, + 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99, +111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, + 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, + 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, + 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, + 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46, +103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101, +108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, + 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 62, + 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, + 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, + 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, + 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, 97,116, + 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, 10,123, + 10, 9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,111,108,111,114,109, 97,112, 44, 32,118, +101, 99, 50, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10, 9,111,117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99, +111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, + 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, + 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, + 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111, +114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, + 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, +101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, + 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, + 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, + 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102, +108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, + 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32, +111,117,116, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115, +118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, + 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, + 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, + 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, + 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, + 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97, +108,117,101, 59, 10, 9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, + 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, + 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9, +111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, + 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40, +102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118, +101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, + 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114, +103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, + 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, + 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, + 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, + 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116, +101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, + 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95, +113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, + 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111, +105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117, +116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114, +116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, + 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, + 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111, +108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111, +114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118, +111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112, +108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32, +118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, + 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, + 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, + 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, + 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111, +108,111,114, 46,103, 41, 59, 10, 9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, + 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, +114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, + 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99, +111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, + 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101, +116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97, +112,112,105,110,103, 10, 9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32, +118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118, +101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110, +111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, +109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111, +114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, + 9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, + 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97, +110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111, +117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,110,103,101,110,116, 46,120,121, +122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105, +101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, + 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, + 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98, +106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118, +109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, + 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, + 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101, +120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100, +111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110, +111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, +109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, + 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114, +109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, + 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, + 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111, +108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, + 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, + 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, + 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, + 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101, +120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, + 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, + 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, + 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, + 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, +116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, + 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111, +118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, + 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111, +117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111, +108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, + 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, + 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, + 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, + 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, + 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, + 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, + 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, + 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, + 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111, +108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, + 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, + 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, +114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, + 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42, +116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, + 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, + 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, + 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100, +105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, + 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, + 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111, +108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111, +108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105, +102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99, +109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111, +108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, + 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, + 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102, +102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, 116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99, 111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99, 103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, - 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105, -100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, - 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, - 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, - 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, - 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, - 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, - 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111, -108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, - 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, - 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, - 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, -111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97, -121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99, -111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99, -103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, - 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40, -102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, - 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, - 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, - 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105, -110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, - 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, - 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101, -120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40, -111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99, -111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, - 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, - 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, - 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, -117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, - 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, - 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111, -108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, - 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111, -108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, - 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, + 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111, +117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10, -123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9, -102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, - 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, - 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, - 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, - 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, - 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, - 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, - 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, - 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99, -116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, - 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, - 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111, -117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, - 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117, -116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102, -108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108, -111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9, -102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101, -120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111, -108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, - 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111, -108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115, -101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99, -116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32, -105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117, -116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118, -101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, - 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, - 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, - 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, - 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, - 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32, -111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, - 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111, -108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, - 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99, -111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, - 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104, -117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, +123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, + 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, + 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, + 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111, +117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9, +105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, + 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, + 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111, +108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, + 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105, +103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108, +111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105, +110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, + 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111, +108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, + 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, + 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, +108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, + 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, + 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, + 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105, +110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, +114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, + 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, + 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118, +101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114, +103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, + 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, - 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, + 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116, 101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, - 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, + 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10, -123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, +123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114, -103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117, -116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102, -108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, - 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, - 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, - 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, - 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111, -108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, - 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111,108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, - 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, - 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, - 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, - 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, - 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, - 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, - 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, -118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32, -116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, - 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99, -109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, - 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40, -102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, - 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, -118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, - 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, - 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, -118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, - 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, - 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, - 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, - 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, - 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, -101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, - 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, - 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, - 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, - 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, - 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116, -101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9, -109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, - 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42, -116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, -108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99, -111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101, -120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, - 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, - 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, - 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101, -120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, - 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, - 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, - 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99, -116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108, +103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32, +111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9, +118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111,108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, + 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, + 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, + 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9, +102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, + 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, + 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32, +109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102, +108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, + 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, + 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, + 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, + 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, + 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, + 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, + 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, + 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32, +109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32, +102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, +102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99, +103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9, +105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, + 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32, +102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, +102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99, +103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, + 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, + 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108, 111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, - 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, -108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, - 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108, -111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, - 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, - 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, - 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, -108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, - 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, - 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, - 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, -108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, - 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, - 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, - 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101, -120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, - 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, - 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, - 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111, -105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, - 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, - 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, -116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, - 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, - 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9, -105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, - 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, -108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, - 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101, -114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10, -123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114, -103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, - 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97, -116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105, -108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,102,108, -111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105,110,116,101,110,115, -105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111,117,116,115,116,101, -110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101, -120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, - 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, - 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, - 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99, -105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102, -115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, - 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40, -118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, - 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, - 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, - 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, - 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40, -118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99, -111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, - 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, - 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32, -111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,101,108, 32,105,115, 32,116,111, 32,109, 97,107,101, 10, 9, 47, - 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112, 32, 99,111,109,112,108,105, 97,110,116, 32,119,105,116,104, 32, -116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,100, 46, 10, 9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32, -116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,115,101, 32,105,110, 32, 66,108,101,110,100,101,114, 10, 9, 47, - 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,100, 32,112,111,105,110,116,115, 32,105,110,119, 97,114,100, 46, - 10, 9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115, 32,101,118,101,114, 32, 99,104, 97,110,103,101, 32,116,104,105, -115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101, 32,114,101,109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, - 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46, -120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42, 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46, -114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98, 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, - 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, -110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, 10,123, 10, 9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, - 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, - 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,109,101,116,104,111,100, 32,116,111, 32,101,120,116, -114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116, 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102, -114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47, 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, - 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109, 51, 59, 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, - 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,109, 52, 91, 49, 93, 46,120,121,122, 59, 10, 9,109, - 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, - 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118, -101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10, 9, 9, - 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, - 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, - 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, - 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32, -102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, - 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10, -123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 86,105,101,119, - 32, 42, 32,109, 79, 98,106, 41, 59, 10, 9,109, 97,116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97, -116, 51, 40,109, 79, 98,106, 73,110,118, 32, 42, 32,109, 86,105,101,119, 73,110,118, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32, -118, 83,105,103,109, 97, 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95, -112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, - 42, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110, -111,114,109, 97,108,105,122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, - 59, 10, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, - 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, - 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, - 42, 32,112,114,101,116,114, 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117, -109,112, 95, 97,112,112,108,121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110, -115,112,111,115,101,100, 32, 42, 47, 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, - 10, 9,118, 82, 50, 32, 61, 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, - 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, - 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, - 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, - 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105, -116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, - 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, - 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118, -101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97, -116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, - 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, - 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, - 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95, -112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114, -102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, - 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, - 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99, -114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111, -114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, - 10, 9,102, 68,101,116, 32, 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, - 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68, -101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, - 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9, -102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, - 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99, -101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, - 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100, -101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111, -117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, - 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32, -118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, - 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70, -100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95, -110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, - 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, - 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, - 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105, -103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, - 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, - 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117, -100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, - 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, - 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, - 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, - 10,123, 10, 9,118,101, 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, - 83, 84,108,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, - 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40, -116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, - 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, - 44, 32, 72,108,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, - 44, 32, 83, 84,108,114, 41, 44, 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114, -101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32, -104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, - 97,108,101, 32, 42, 32, 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, - 98,117,109,112, 95,116, 97,112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, - 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116, -101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, - 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9, -118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68, -120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, - 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, - 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46, -120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72, -108, 44, 72,114, 44, 72,100, 44, 72,117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40, -105,109, 97, 44, 32, 83, 84, 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117, -114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32, -116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116, -111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, - 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72, -117, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, - 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, - 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108, -111, 97,116, 32,105,109, 97, 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59, - 9, 9, 47, 47, 32,110,101,103, 97,116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116, -117,114,101, 32, 99,111,111,114,100,105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100, -120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40, -116,101,120, 99,111, 46,120,121, 41, 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115, -105,110,103, 32, 97, 32,100,101,114,105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101, -100, 32,104,101,114,101, 10, 9, 47, 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98, -108,111,103,115,112,111,116, 46, 99,111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, - 97,112,115, 46,104,116,109,108, 10, 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, - 32,105,109, 97, 95,121, 41, 59, 10, 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105, -109, 42, 40, 50, 46, 48, 42,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46, -120,121, 45, 49, 46, 48, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46, -120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, 32, 61, 32,100, 66, -100,117,118, 46,120, 42, 84,101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46, -121, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97, -116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, - 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, - 10, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, - 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, 66,115, 32, 42, 32, -118, 82, 49, 32, 43, 32,100, 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, - 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98, -101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, - 99,101, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, - 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101,114, - 50, 68, 32,105,109, 97, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, - 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, - 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101, -120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68, -121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, - 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32,100, 66,115, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, - 68,120, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 49, 32, 43, 32, 10, - 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40, -105,109, 97, 95,120, 42, 84,101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, - 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 9, 9, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, - 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, - 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,109,116,101,120, 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,110,111, -114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,111,117,116, -110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, - 46,121, 44, 32,110,111,114,109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,115,112, 97, - 99,101, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, 99, 51, 32,110,111, -114,109, 97,108, 44, 32,118,101, 99, 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, -117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101,110,116, 46,119, 32, - 42, 32, 99,114,111,115,115, 40,110,111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10, 10, 9, -111,117,116,110,111,114,109, 97,108, 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110,103,101,110,116, 46, -120,121,122, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46, -122, 42,110,111,114,109, 97,108, 59, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, - 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,108,101,110,100, 95, -110,111,114,109, 97,108, 40,102,108,111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, - 44, 32,118,101, 99, 51, 32,110,101,119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111, -114,109, 97,108, 41, 10,123, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32,110,111,114,102, - 97, 99, 41, 42,110,111,114,109, 97,108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, 97,108, 59, 10, 9, -111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, - 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 47, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, 95,104,101,109,105, - 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, - 10, 9,108,118, 32, 61, 32,108, 97,109,112,118,101, 99, 59, 10, 9,100,105,115,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,118,105, -115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105, -108,105,116,121, 95,111,116,104,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, - 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32, 99,111, 32, 45, 32,108, 97, -109,112, 99,111, 59, 10, 9,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10, 9,108,118, 32, 61, 32, -110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, - 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, 97,114, 40,102,108, -111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105, -115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97, -109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100, -105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, - 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100, -105,115,116, 32, 43, 32,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, - 97,108,108,111,102,102, 95,115,108,105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102, -108,111, 97,116, 32,108,100, 49, 44, 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,108, 97,109, -112,100,105,115,116,107,119, 32, 61, 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, 59, 10, 10, 9,118, -105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,108,100, - 49, 42,100,105,115,116, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105,115,116,107,119, 47, - 40,108, 97,109,112,100,105,115,116,107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, - 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108,111, 97,116, 32,108, - 97,109,112,100,105,115,116, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,102,108,111, - 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118, -105,115,105,102, 97, 99, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, - 50, 40,100,105,115,116, 47,108, 97,109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, 10, 10,118,111,105, -100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108,111, 97,116, 32,108, - 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, - 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, - 97,116, 32,116, 61, 32,108, 97,109,112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10, 9,111,117,116,118,105,115,105, -102, 97, 99, 61, 32,118,105,115,105,102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97,109,112,100,105,115, -116, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, -115,113,117, 97,114,101, 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, 97,109,112,105,109, - 97,116, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10, 9, -105,102, 40,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,118, -101, 99, 51, 32,108,118,114,111,116, 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40,108,118, 44, 32, 48, - 46, 48, 41, 41, 46,120,121,122, 59, 10, 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, 98,115, 40,108,118, -114,111,116, 46,120, 47,108,118,114,111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, 47,108,118,114,111, -116, 46,122, 41, 41, 59, 10, 10, 9, 9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, 46, 48, 32, 43, 32, -120, 42,120, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 10, 9, 9,105,110,112,114, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10, -118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99,105,114, 99,108,101, - 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,105,110,112,114, 41, 10,123, 10, 9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, - 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, - 40,102,108,111, 97,116, 32,115,112,111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, 44, 32,102,108,111, - 97,116, 32,105,110,112,114, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 32, 61, 32,115,112,111,116,115, -105, 59, 10, 10, 9,105,102, 40,105,110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10, 9, 9,111,117,116,118,105,115,105,102, 97, - 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,116, 32, 61, 32,105,110,112,114, 32, 45, - 32,116, 59, 10, 10, 9, 9, 47, 42, 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10, 9, 9,105,102, 40,115,112,111,116, - 98,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116,104,115,116,101,112, - 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10, 9, 9,111,117,116,118,105,115,105, -102, 97, 99, 32, 61, 32,118,105,115,105,102, 97, 99, 42,105,110,112,114, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,108, - 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,118,105,115,105,102, - 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,111,117,116, -118,105,115,105,102, 97, 99, 32, 61, 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, 63, 32, 48, 46, 48, - 58, 32,118,105,115,105,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,101,119, 40,118,101, - 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10, 9, 47, 42, 32,104, 97,110,100, -108,101, 32,112,101,114,115,112,101, 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, 32, 42, 47, 10, 9, -118,105,101,119, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, - 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118,101, 99, 51, 40, 48, - 46, 48, 44, 32, 48, 46, 48, 44, 32, 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97, -110,103,101,110,116, 95,118, 40,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40,108,118, 44, 32,116, - 97,110,103, 41, 59, 10, 9,118,101, 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, 32,116, 97,110,103, - 41, 59, 10, 10, 9,118,110, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,105,110,112, 41, 10,123, 10, 9,105,110,112, 32, 61, 32,100,111,116, 40,118,110, 44, 32, -108,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105,102,102,117,115,101, - 40,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, 43, 32, 48, 46, 53, - 59, 10,125, 10, 10,102,108,111, 97,116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40,109, 97,116, 52, - 32, 97,114,101, 97, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,101, 99, 51, - 32,118,101, 99, 91, 52, 93, 44, 32, 99, 91, 52, 93, 59, 10, 9,102,108,111, 97,116, 32,114, 97,100, 91, 52, 93, 44, 32,102, 97, - 99, 59, 10, 9, 10, 9,118,101, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114, -101, 97, 91, 48, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, - 99,111, 32, 45, 32, 97,114,101, 97, 91, 49, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 50, 93, 32, 61, 32,110,111,114, -109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 51, - 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46,120,121,122, 41, 59, - 10, 10, 9, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 48, 93, - 44, 32,118,101, 99, 91, 49, 93, 41, 41, 59, 10, 9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114, -111,115,115, 40,118,101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9, 99, 91, 50, 93, 32, 61, 32,110,111, -114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, - 9, 99, 91, 51, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 51, 93, 44, 32, -118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10, 9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, - 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, 99,111,115, 40,100, -111,116, 40,118,101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 50, 93, 32, 61, 32, 97, - 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 51, - 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10, - 9,102, 97, 99, 61, 32, 32,114, 97,100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, 59, 10, 9,102, 97, - 99, 43, 61, 32,114, 97,100, 91, 49, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, - 32,114, 97,100, 91, 50, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97, -100, 91, 51, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10, 9,114,101,116,117,114,110, 32,109, 97,120, - 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 95, 97,114, -101, 97, 40,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,118, -101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, 97,114,101, 97, 44, - 32,102,108,111, 97,116, 32, 97,114,101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,105,110,112, 41, 10,123, 10, 9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116,105,111,110, 59, 10, - 9,118,101, 99, 51, 32,118,101, 99, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10, 9,105,102, 40,100,111, -116, 40,118,101, 99, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,110,112, 32, 61, - 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,105,110,116,101,110,115, 32, - 61, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, 44, 32,118,110, 41, - 59, 10, 10, 9, 9,105,110,112, 32, 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115,105,122,101, 44, 32, -107, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,111,114,101, -110, 95,110, 97,121,101,114, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, - 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,105,115, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, - 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, - 48, 41, 59, 10, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, - 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, - 10, 9,105,102, 40,114,101, 97,108,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, - 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, - 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, - 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 76,105,116, 95, 65, 32, - 61, 32, 97, 99,111,115, 40,114,101, 97,108,110,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 86,105,101,119, 95, 65, 32, 61, - 32, 97, 99,111,115, 40,110,118, 41, 59, 10, 10, 9, 9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32,110,111,114,109, 97, -108,105,122,101, 40,108, 32, 45, 32,114,101, 97,108,110,108, 42,110, 41, 59, 10, 9, 9,118,101, 99, 51, 32, 86,105,101,119, 95, - 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10, 9, 9,102,108,111, 97, -116, 32,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, 41, 44, 32, 48, 46, - 48, 41, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10, 9, 9,105,102, 40, 76,105,116, 95, 65, 32, 62, - 32, 86,105,101,119, 95, 65, 41, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9, 9, 98, 32, 61, 32, - 86,105,101,119, 95, 65, 59, 10, 9, 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 86,105,101,119, - 95, 65, 59, 10, 9, 9, 9, 98, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9,125, 10, 10, 9, 9,102,108,111, 97,116, 32, 65, - 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114, -111,117,103,104, 42,114,111,117,103,104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 66, - 32, 61, 32, 48, 46, 52, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114, -111,117,103,104, 41, 32, 43, 32, 48, 46, 48, 57, 41, 41, 59, 10, 10, 9, 9, 98, 32, 42, 61, 32, 48, 46, 57, 53, 59, 10, 9, 9, -105,115, 32, 61, 32,110,108, 42, 40, 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, 41, 32, 42, 32,116, - 97,110, 40, 98, 41, 41, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115, -101, 95,116,111,111,110, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102, -108,111, 97,116, 32,115,105,122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,105,115, 41, 10,123, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,110, 44, 32,108, - 41, 59, 10, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, - 40, 97,110,103, 32, 60, 32,115,105,122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, - 97,110,103, 32, 62, 32, 40,115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116, -104, 32, 61, 61, 32, 48, 46, 48, 41, 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,115, 32, 61, 32, 49, - 46, 48, 32, 45, 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, 40,102,108,111, 97, -116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,100, 97,114,107, -110,101,115,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,102, 40,110,108, 32, 60, 61, 32, - 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, -102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, - 10, 9, 9,105,102, 40,100, 97,114,107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10, 9, 9, 9,105,115, 32, 61, 32,110, -108, 42,112,111,119, 40,109, 97,120, 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107,110,101,115,115, 32, - 45, 32, 49, 46, 48, 41, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40, 49, 46, - 48, 48, 48, 49, 32, 45, 32,110,118, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10, 9,125, 10,125, - 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105,101,119, 44, 32,118, -101, 99, 51, 32,118,110, 44, 32,102,108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, - 10, 9,102,108,111, 97,116, 32,116, 49, 44, 32,116, 50, 59, 10, 9,102,108,111, 97,116, 32,102,102, 97, 99, 59, 10, 10, 9,105, -102, 40,102, 97, 99, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 9, -101,108,115,101, 32,123, 10, 9, 9,116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, 10, 9, 9,105,102, - 40,116, 49, 62, 48, 46, 48, 41, 32, 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10, 9, 9,101,108,115,101, 32,116, 50, 61, - 32, 49, 46, 48, 45,116, 49, 59, 10, 10, 9, 9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, 45,103,114, 97,100, - 41, 42,112,111,119, 40,116, 50, 44, 32,102, 97, 99, 41, 59, 10, 10, 9, 9,105,102, 40,116, 50, 60, 48, 46, 48, 41, 32,102,102, - 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, 32,102,102, 97, 99, - 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10, 9,125, 10, 10, 9,114, -101,116,117,114,110, 32,102,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115, -101, 95,102,114,101,115,110,101,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, - 32,118,105,101,119, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32,102,114,101,115,110,101,108, 95,102, 97, 99, - 40,108,118, 44, 32,118,110, 44, 32,102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, - 97,100,101, 95, 99,117, 98,105, 99, 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,105,115, 41, 10,123, 10, 9,105,102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, 41, 10, 9, 9,111, -117,116,105,115, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,105,115, 41, 59, 10, - 9,101,108,115,101, 10, 9, 9,111,117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, - 95,118,105,115,105,102, 97, 99, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, - 32,102,108,111, 97,116, 32,114,101,102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, 41, 10,123, 10, 9, - 47, 42,105,102, 40,105, 32, 62, 32, 48, 46, 48, 41, 42, 47, 10, 9, 9,111,117,116,105, 32, 61, 32,109, 97,120, 40,105, 42,118, -105,115,105,102, 97, 99, 42,114,101,102,108, 44, 32, 48, 46, 48, 41, 59, 10, 9, 47, 42,101,108,115,101, 10, 9, 9,111,117,116, -105, 32, 61, 32,105, 59, 42, 47, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, - 95,115,112,101, 99, 40,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, - 9,118,110, 32, 61, 32,116, 97,110,103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,116,111, - 95,100,105,102,102,117,115,101, 40,102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32, -118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,105,102, - 40,105, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, 99,111,108, 42, 99, -111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, - 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109,105, 95,115,112,101, - 99, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102, -108,111, 97,116, 32,115,112,101, 99, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97,116, 32,118,105,115, -105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,108,118, 32, 43, 61, 32,118,105,101,119, - 59, 10, 9,108,118, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10, 9,116, 32, 61, 32,100,111,116, - 40,118,110, 44, 32,108,118, 41, 59, 10, 9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, 10, 10, 9,116, 32, - 61, 32,118,105,115,105,102, 97, 99, 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,115,104, 97,100,101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, - 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105, -122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97,120, 40,100,111,116, - 40,104, 44, 32,110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,112,111,119, 40,114,115, -108,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111,111,107,116,111,114, -114, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102, -108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, - 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111, - 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 10, 9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, - 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, - 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, - 59, 10, 9, 9,102,108,111, 97,116, 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, 59, 10, 10, 9, 9, -105, 32, 61, 32,105, 47, 40, 48, 46, 49, 43,110,118, 41, 59, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,105, 59, 10, 9, -125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32, -110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101,102,114, 97, 99, 44, - 32,102,108,111, 97,116, 32,115,112,101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, - 99,102, 97, 99, 41, 10,123, 10, 9,105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,115,112, -101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,115,112,101, 99, 95,112,111, -119,101,114, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, -125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, 48, 48, 46, 48, 41, - 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112,101, 99, 95,112,111, -119,101,114, 41, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, 32, 49, 48, 46, 48, - 47,115,112,101, 99, 95,112,111,119,101,114, 59, 10, 10, 9, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105, -122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, - 41, 59, 10, 9, 9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, - 32, 48, 46, 48, 59, 10, 9, 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, - 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 9, 9, 9,102,108,111, 97,116, 32, -110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 9, 9, 9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 49, - 41, 32,123, 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 9,125, 10, 9, 9, 9,101, -108,115,101, 32,123, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32, -104, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, 46, 48, 59, 10, 9, - 9, 9, 9,102,108,111, 97,116, 32, 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, 59, 10, 9, 9, 9, - 9,102,108,111, 97,116, 32, 99, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, 10, 9, 9, 9, 9, -102,108,111, 97,116, 32,103, 32, 61, 32, 48, 46, 48, 59, 10, 10, 9, 9, 9, 9,105,102, 40, 97, 32, 60, 32, 98, 32, 38, 38, 32, - 97, 32, 60, 32, 99, 41, 32,103, 32, 61, 32, 97, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 98, 32, 60, 32, 97, 32, - 38, 38, 32, 98, 32, 60, 32, 99, 41, 32,103, 32, 61, 32, 98, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 99, 32, 60, - 32, 97, 32, 38, 38, 32, 99, 32, 60, 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,112, - 32, 61, 32,115,113,114,116, 40, 40, 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, 40,118,104, 42,118, -104, 41, 45, 49, 46, 48, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40,112, 45,118,104, 41, - 42, 40,112, 45,118,104, 41, 41, 47, 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, 49, 46, 48, 43, 40, - 40, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, - 49, 46, 48, 41, 41, 47, 40, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, - 45,118,104, 41, 41, 43, 49, 46, 48, 41, 41, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, - 99,111,115, 40,110,104, 41, 59, 10, 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 42,103, 42, -101,120,112, 95, 98,108,101,110,100,101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, 48, 42,115,112,101, - 99, 95,112,111,119,101,114, 42,115,112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 9, -125, 10, 9, 9,125, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100,105,115,111, 95,115, -112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97, -116, 32,114,109,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, - 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,110, -104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97, -116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102, -108,111, 97,116, 32,110,108, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, - 10, 9,102,108,111, 97,116, 32, 97,110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, 41, 41, 59, 10, 9, -102,108,111, 97,116, 32, 97,108,112,104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 10, - 9,115,112,101, 99,102, 97, 99, 61, 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, 80, 73, 42, 97,108, -112,104, 97, 42, 97,108,112,104, 97, 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, 97,110,103,108,101, - 42, 97,110,103,108,101, 41, 47, 40, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114,116, 40,110,118, 42, -110,108, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115,112,101, 99, 40,118, -101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122, -101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99, -102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, - 41, 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, 10, 9,102,108,111, - 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32, -115,105,122,101, 41, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, - 61, 32, 40,115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, - 32, 48, 46, 48, 41, 32,114,115,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,114,115,108,116, 32, 61, 32, 49, - 46, 48, 32, 45, 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10, 10, 9,115, -112,101, 99,102, 97, 99, 32, 61, 32,114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, - 99, 95, 97,114,101, 97, 95,105,110,112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102,108,111, 97,116, 32, -105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,111,117, -116,115,112,101, 99,102, 97, 99, 32, 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10,118,111,105,100, 32, -115,104, 97,100,101, 95,115,112,101, 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97, -116, 32,115,112,101, 99, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, - 99,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,116, 32, 61, 32,115,104, 97,100,102, 97, - 99, 42,115,112,101, 99, 42,118,105,115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32, -115,104, 97,100,101, 95, 97,100,100, 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, 51, 32,108, 97,109, -112, 99,111,108, 44, 32,118,101, 99, 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, - 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42,115,112,101, 99, 99, -111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, - 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9, -111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, - 97,100,101, 95,109, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, - 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, - 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115, -104, 97,100,101, 95, 97,100,100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, - 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111, -108, 32, 61, 32, 99,111,108, 49, 32, 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, - 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97, -100,100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32, -118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111, -117,116, 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, 44, 32,118,101, 99, - 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -115,104, 97,100,101, 95,109, 97,100,100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 44, 32,118, -101, 99, 52, 32, 99,111,108, 49, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117, -116, 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97, -100,101, 95,109,117,108, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 42, 99, -111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117,101, 40,102,108,111, - 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111, -108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32, -115,104, 97,100,101, 95,111, 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99, -111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, - 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 41, 59, - 10,125, 10, 10,118,111,105,100, 32,114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, 99,111,108,111,114, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, - 99,111,108,111,114, 46,114, 42, 48, 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, 43, 32, 99,111,108, -111,114, 46, 98, 42, 48, 46, 49, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, - 97,100,111,119, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, - 97,116, 32,101,110,101,114,103,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97,100,102, 97, 99, 41, - 10,123, 10, 9,111,117,116,115,104, 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, 49, 46, 48, 32, 45, - 32,115,104, 97,100,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, - 97,100,111,119, 95,100,105,102,102,117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, - 32,114,103, 98, 44, 32,118,101, 99, 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,100,105,102, -102, 41, 10,123, 10, 9,111,117,116,100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, 40,114,103, 98, 42, -115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108, -121, 95,115,104, 97,100,111,119, 95,115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, - 32,118,101, 99, 51, 32,115,112,101, 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111,117,116, 32,118,101, - 99, 52, 32,111,117,116,115,112,101, 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99, 32, 61, 32,115,112,101, 99, 32, 45, 32, -118,101, 99, 52, 40,115,112,101, 99,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,116,101,115,116, 95,115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, 44, 32,115, 97,109, -112,108,101,114, 50, 68, 83,104, 97,100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, 52, 32,115,104, 97, -100,111,119,112,101,114,115,109, 97,116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97,115, 44, 32,102,108, -111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,105,102, - 40,105,110,112, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9, -125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111,119,112,101,114,115, -109, 97,116, 42,118,101, 99, 52, 40,114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9, 9, 47, 47,102,108,111, 97,116, 32, 98, -105, 97,115, 32, 61, 32, 40, 49, 46, 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111,119, 98,105, 97,115, - 59, 10, 9, 9, 99,111, 46,122, 32, 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, 59, 10, 10, 9, 9, -114,101,115,117,108,116, 32, 61, 32,115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111,119,109, 97,112, 44, - 32, 99,111, 41, 46,120, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120,112,111,115,117,114, -101, 95, 99,111,114,114,101, 99,116, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108,105,110,102, 97, 99, - 44, 32,102,108,111, 97,116, 32,108,111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, - 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32,101,120,112, 40, 99, -111,108, 42,108,111,103,102, 97, 99, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,105,115,116, 95, -102, 97, 99,116,111,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115,116, 97, 44, 32,102, -108,111, 97,116, 32,109,105,115,116,100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121,112,101, 44, 32,102, -108,111, 97,116, 32,109,105,115,105, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9, -102,108,111, 97,116, 32,102, 97, 99, 44, 32,122, 99,111,114, 59, 10, 10, 9,122, 99,111,114, 32, 61, 32, 40,103,108, 95, 80,114, -111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,108,101, -110,103,116,104, 40, 99,111, 41, 58, 32, 45, 99,111, 91, 50, 93, 59, 10, 9, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, - 40, 40,122, 99,111,114, 45,109,105,115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, 46, 48, 44, 32, 49, - 46, 48, 41, 59, 10, 9,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, 97, 99, 32, 42, 61, - 32,102, 97, 99, 59, 10, 9,101,108,115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 49, 46, 48, 41, 59, - 10, 9,101,108,115,101, 32,102, 97, 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10, 9,111,117,116,102, 97, 99, - 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115,105, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, 32,104,111,114, 44, - 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, -108,111, 97,116, 32,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, - 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, 99,111,108, 46,114, -103, 98, 44, 32,102, 97, 99, 41, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, - 97,108,112,104, 97, 95,111,112, 97,113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32, -111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, - 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111, 98, 99,111, -108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, + 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, +102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, + 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, + 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, + 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, + 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, + 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32, +102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, +102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99, +103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, + 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111, +108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, + 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, + 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32, +102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42, +116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, + 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111, +108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, + 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, + 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32, +102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42, +116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, + 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,112,111,115,105,116,105,118,101, 40,102,108, +111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117, +116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, + 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100, +105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97, +114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32, +104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, + 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, + 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, + 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10, +125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, + 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, + 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99, +111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46, -114,103, 98, 44, 32, 99,111,108, 46, 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116, -114,105, 99, 40,118,101, 99, 51, 32, 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114,109, 97,108, 44, 32, -102,108,111, 97,116, 32,101,116, 97, 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, 32,102,114,101,115, -110,101,108, 32,114,101,102,108,101, 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112,108,105, 99,105,116, -108,121, 32, 99,111,109,112,117,116,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102,114, 97, 99,116,101, -100, 32,100,105,114,101, 99,116,105,111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, 61, 32, 97, 98,115, - 40,100,111,116, 40, 73,110, 99,111,109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, 32, 32,102,108,111, - 97,116, 32,103, 32, 61, 32,101,116, 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, 42, 32, 99, 59, 10, - 32, 32, 32, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, 32, 62, 32, 48, 46, - 48, 41, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, 32, 32, 32, 32, 32, - 32, 32,102,108,111, 97,116, 32, 65, 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, 10, 32, 32, 32, 32, - 32, 32, 32, 32,102,108,111, 97,116, 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, 46, 48, 41, 47, 40, - 99, 32, 42, 40,103, 32, 45, 32, 99, 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, - 32, 61, 32, 48, 46, 53, 32, 42, 32, 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, 66, 41, 59, 10, 32, - 32, 32, 32,125, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 49, - 46, 48, 59, 32, 32, 47, 42, 32, 84, 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99,111,109,112,111,110, -101,110,116, 41, 32, 42, 47, 10, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, 10,125, 10, 10,102, -108,111, 97,116, 32,104,121,112,111,116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, 41, 10,123, 10, 9, -114,101,116,117,114,110, 32,115,113,114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 32, 51, 10, - 10, 47, 42, 32, 98,115,100,102,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,100,105,102, -102,117,115,101, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32, 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, - 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99, -116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, - 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108, -105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, - 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102, -102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, - 46,114,103, 98, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,109, 97,120, 40,100,111,116, 40, 78, 44, - 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108, -105,103,104,116, 95,100,105,102,102,117,115,101, 42, 98,115,100,102, 59, 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, - 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,110,111,100,101, 95, 98,115,100,102, 95,103,108,111,115,115,121, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108, -111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, - 40, 48, 46, 48, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, - 47, 10, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, - 59, 32,105, 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, - 99,101, 91,105, 93, 46,104, 97,108,102, 86,101, 99,116,111,114, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103, -104,116, 95,115,112,101, 99,117,108, 97,114, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46, -115,112,101, 99,117,108, 97,114, 46,114,103, 98, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,112,111, -119, 40,109, 97,120, 40,100,111,116, 40, 78, 44, 32, 72, 41, 44, 32, 48, 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104, -110,101,115,115, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 42, 98,115,100, -102, 59, 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, - 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95, 97,110,105,115,111, -116,114,111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101, -115,115, 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 86, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118, -101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, - 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10, -125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108, 97,115,115, 40,118,101, 99, 52, 32, 99,111,108, -111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,102,108,111, 97,116, 32,105,111,114, 44, 32, -118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, - 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 78, 44, 32, -114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115, -108,117, 99,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118, -101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, - 40, 99,111,108,111,114, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, - 95, 98,115,100,102, 95,116,114, 97,110,115,112, 97,114,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117, -116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32, -114,105,103,104,116, 32, 42, 47, 10, 9,114,101,115,117,108,116, 46,114, 32, 61, 32, 99,111,108,111,114, 46,114, 59, 10, 9,114, -101,115,117,108,116, 46,103, 32, 61, 32, 99,111,108,111,114, 46,103, 59, 10, 9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99, -111,108,111,114, 46, 98, 59, 10, 9,114,101,115,117,108,116, 46, 97, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, - 32,110,111,100,101, 95, 98,115,100,102, 95,118,101,108,118,101,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108, -111, 97,116, 32,115,105,103,109, 97, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117, +114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105, +110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, + 41, 10,123, 10, 9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, + 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, + 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, + 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, +114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, + 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, +116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, + 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115, +116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,110,116,101,110,115,105,116,121, 41, 10, +123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105, +110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111, +117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105, +100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, + 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, + 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, + 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, + 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32, +115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105, +110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101, +120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95, +115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122, +101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, + 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111, +117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, + 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105, +109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, + 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, + 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, + 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, + 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 47, 32, 84,104,101, 32,105,110, +118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,101,108, 32,105,115, 32,116,111, 32,109, 97, +107,101, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112, 32, 99,111,109,112,108,105, 97,110,116, 32, +119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,100, 46, 10, 9, 47, 47, 32, 73,116, 32,110, +101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,115,101, 32,105,110, 32, 66,108,101,110,100, +101,114, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,100, 32,112,111,105,110,116,115, 32,105,110, +119, 97,114,100, 46, 10, 9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115, 32,101,118,101,114, 32, 99,104, 97,110,103, +101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101, 32,114,101,109,111,118,101,100, 46, 10, 32, + 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116, +101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42, 40,118,101, 99, 51, 40, 45, 99, +111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98, 41, 32, 45, 32,118,101, 99, 51, + 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, + 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,118, 78, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, 10,123, 10, 9,118, 78,111,114,103, 32, + 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117, +100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,109,101,116,104,111,100, 32,116, +111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116, 32, 51,120, 51, 32,109, 97,116, +114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47, 10,109, 97,116, 51, 32,116,111, + 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109, 51, 59, 10, 9,109, 51, 91, 48, + 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,109, 52, 91, 49, 93, 46,120,121, +122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,114,101,116,117,114,110, 32,109, + 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,111, 98,106,115,112, 97, + 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114, +109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,109, 97,116, 52, 32,109, 86,105, +101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 73,110,118, 44, 32, + 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105, +110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102, +108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32, +118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101, +116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,116,111, 95,109, 97,116, 51, 40, +109, 86,105,101,119, 32, 42, 32,109, 79, 98,106, 41, 59, 10, 9,109, 97,116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32, +116,111, 95,109, 97,116, 51, 40,109, 79, 98,106, 73,110,118, 32, 42, 32,109, 86,105,101,119, 73,110,118, 41, 59, 10, 9, 10, 9, +118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32, +115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, + 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, + 78, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118, +105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, + 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, + 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, + 10, 9, 10, 9, 47, 42, 32,112,114,101,116,114, 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116, +101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, + 32,116,114, 97,110,115,112,111,115,101,100, 32, 42, 47, 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, + 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, + 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110, +105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, + 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116, +117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, + 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, + 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, + 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95, +105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, + 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118, +101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, + 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, +102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32, +115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, + 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111, +114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118, +101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105, +122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, + 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, + 32, 41, 32, 41, 59, 10, 9,102, 68,101,116, 32, 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, + 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, + 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, + 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105, +110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105, +116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101, +119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, + 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103, +110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, + 9, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, + 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, + 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, + 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, + 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32, +115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111, +108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, + 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111, +115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, + 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110, +105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32, +118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97, +103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, + 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, + 95,116, 97,112, 51, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, + 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, + 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9, +118,101, 99, 50, 32, 83, 84,108,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99, +111, 46,120,121, 41, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, +100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108, +114, 44, 72,117,108, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, + 83, 84,108,108, 41, 44, 32, 72,108,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, + 68, 40,105,109, 97, 44, 32, 83, 84,108,114, 41, 44, 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116, +101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, + 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, + 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32, +109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112, +108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117, +116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, + 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100, +121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46, +120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, + 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, + 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46, +120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116, +101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, + 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100, 44, 72,117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117, +114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32, +116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116, +111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, + 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72, +100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, +117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, + 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32, +116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95, +120, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66, +115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, + 32, 49, 46, 48, 59, 9, 9, 47, 47, 32,110,101,103, 97,116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, + 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100,105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, + 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32, +100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97, +110,116, 32,117,115,105,110,103, 32, 97, 32,100,101,114,105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, + 99,114,105, 98,101,100, 32,104,101,114,101, 10, 9, 47, 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101, +110, 51,100, 46, 98,108,111,103,115,112,111,116, 46, 99,111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116, +105,118,101, 45,109, 97,112,115, 46,104,116,109,108, 10, 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105, +109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41, 59, 10, 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97, +108,101, 42,100,105,109, 42, 40, 50, 46, 48, 42,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, + 46,120,121, 41, 46,120,121, 45, 49, 46, 48, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84, +101,120, 68,120, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, + 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84, +101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, + 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66, +116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, + 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118, +101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, + 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100, 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 10, 9,118, 78, 97, 99, 99, + 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101, +114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95, +111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116, +101,120,115,112, 97, 99,101, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32, +102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97, +109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105, +109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, + 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, + 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, + 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 51, 32, +118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, 9, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95, +120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, + 49, 32, 43, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32, +118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46, +121, 41, 32, 41, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 9, 9, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32, +118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, + 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, + 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, + 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110, +111,114,109, 97,108, 46,121, 44, 32,110,111,114,109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, + 95,110,115,112, 97, 99,101, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, + 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101, 99, 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118, +101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101, +110,116, 46,119, 32, 42, 32, 99,114,111,115,115, 40,110,111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, + 41, 59, 10, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110, +103,101,110,116, 46,120,121,122, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111, +114,109, 97,108, 46,122, 42,110,111,114,109, 97,108, 59, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, + 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98, +108,101,110,100, 95,110,111,114,109, 97,108, 40,102,108,111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110, +111,114,109, 97,108, 44, 32,118,101, 99, 51, 32,110,101,119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32, +111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, + 32,110,111,114,102, 97, 99, 41, 42,110,111,114,109, 97,108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, + 97,108, 59, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111, +114,109, 97,108, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, + 95,104,101,109,105, 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, + 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32,108, 97,109,112,118,101, 99, 59, 10, 9,100,105,115,116, 32, 61, 32, 49, 46, 48, + 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118, +105,115,105, 98,105,108,105,116,121, 95,111,116,104,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97, +109,112, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115, +116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32, 99,111, + 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 9,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10, 9, +108,118, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, + 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, + 97,114, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, + 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32, +108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, +118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40, +108, 97,109,112,100,105,115,116, 32, 43, 32,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, + 97,109,112, 95,102, 97,108,108,111,102,102, 95,115,108,105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105, +115,116, 44, 32,102,108,111, 97,116, 32,108,100, 49, 44, 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32, +100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97, +116, 32,108, 97,109,112,100,105,115,116,107,119, 32, 61, 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, + 59, 10, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, + 32, 43, 32,108,100, 49, 42,100,105,115,116, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105, +115,116,107,119, 47, 40,108, 97,109,112,100,105,115,116,107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108, +111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, + 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, + 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, + 44, 32,118,101, 99, 50, 40,100,105,115,116, 47,108, 97,109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, + 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108, +111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32, +118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, + 10, 9,102,108,111, 97,116, 32,116, 61, 32,108, 97,109,112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10, 9,111,117, +116,118,105,115,105,102, 97, 99, 61, 32,118,105,115,105,102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97, +109,112,100,105,115,116, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95, +115,112,111,116, 95,115,113,117, 97,114,101, 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, + 97,109,112,105,109, 97,116, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, + 41, 10,123, 10, 9,105,102, 40,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32, +123, 10, 9, 9,118,101, 99, 51, 32,108,118,114,111,116, 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40, +108,118, 44, 32, 48, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, + 98,115, 40,108,118,114,111,116, 46,120, 47,108,118,114,111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, + 47,108,118,114,111,116, 46,122, 41, 41, 59, 10, 10, 9, 9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, + 46, 48, 32, 43, 32,120, 42,120, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 10, 9, 9,105,110,112,114, 32, 61, 32, 48, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99, +105,114, 99,108,101, 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10, 9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, + 97,109,112,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, + 95,115,112,111,116, 40,102,108,111, 97,116, 32,115,112,111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, + 44, 32,102,108,111, 97,116, 32,105,110,112,114, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 32, 61, 32, +115,112,111,116,115,105, 59, 10, 10, 9,105,102, 40,105,110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10, 9, 9,111,117,116,118, +105,115,105,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,116, 32, 61, 32,105, +110,112,114, 32, 45, 32,116, 59, 10, 10, 9, 9, 47, 42, 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10, 9, 9,105,102, + 40,115,112,111,116, 98,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116, +104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10, 9, 9,111,117, +116,118,105,115,105,102, 97, 99, 32, 61, 32,118,105,115,105,102, 97, 99, 42,105,110,112,114, 59, 10, 9,125, 10,125, 10, 10,118, +111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32, +118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, + 10, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, + 63, 32, 48, 46, 48, 58, 32,118,105,115,105,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105, +101,119, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10, 9, 47, 42, + 32,104, 97,110,100,108,101, 32,112,101,114,115,112,101, 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, + 32, 42, 47, 10, 9,118,105,101,119, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, + 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118, +101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97, +100,101, 95,116, 97,110,103,101,110,116, 95,118, 40,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40, +108,118, 44, 32,116, 97,110,103, 41, 59, 10, 9,118,101, 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, + 32,116, 97,110,103, 41, 59, 10, 10, 9,118,110, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, + 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112, 41, 10,123, 10, 9,105,110,112, 32, 61, 32,100,111,116, + 40,118,110, 44, 32,108,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105, +102,102,117,115,101, 40,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 48, 59, + 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, + 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, + 43, 32, 48, 46, 53, 59, 10,125, 10, 10,102,108,111, 97,116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, + 40,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, + 9,118,101, 99, 51, 32,118,101, 99, 91, 52, 93, 44, 32, 99, 91, 52, 93, 59, 10, 9,102,108,111, 97,116, 32,114, 97,100, 91, 52, + 93, 44, 32,102, 97, 99, 59, 10, 9, 10, 9,118,101, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, + 32, 45, 32, 97,114,101, 97, 91, 48, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97, +108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 49, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 50, 93, 32, + 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10, 9, +118,101, 99, 91, 51, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46, +120,121,122, 41, 59, 10, 10, 9, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118, +101, 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49, 93, 41, 41, 59, 10, 9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105, +122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9, 99, 91, 50, 93, + 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, + 93, 41, 41, 59, 10, 9, 99, 91, 51, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, + 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10, 9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100, +111,116, 40,118,101, 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, + 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 50, + 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9, +114, 97,100, 91, 51, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, + 41, 41, 59, 10, 10, 9,102, 97, 99, 61, 32, 32,114, 97,100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, + 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 49, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10, 9, +102, 97, 99, 43, 61, 32,114, 97,100, 91, 50, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10, 9,102, 97, 99, + 43, 61, 32,114, 97,100, 91, 51, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10, 9,114,101,116,117,114, +110, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105, +110,112, 95, 97,114,101, 97, 40,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, + 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, + 97,114,101, 97, 44, 32,102,108,111, 97,116, 32, 97,114,101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,105,110,112, 41, 10,123, 10, 9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116, +105,111,110, 59, 10, 9,118,101, 99, 51, 32,118,101, 99, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10, 9, +105,102, 40,100,111,116, 40,118,101, 99, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, +105,110,112, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,105,110, +116,101,110,115, 32, 61, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, + 44, 32,118,110, 41, 59, 10, 10, 9, 9,105,110,112, 32, 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115, +105,122,101, 44, 32,107, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115, +101, 95,111,114,101,110, 95,110, 97,121,101,114, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118, +101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, +118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, + 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32, +118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, + 32,108, 41, 59, 10, 10, 9,105,102, 40,114,101, 97,108,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, + 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, +105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,118,104, 32, + 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 76, +105,116, 95, 65, 32, 61, 32, 97, 99,111,115, 40,114,101, 97,108,110,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 86,105,101, +119, 95, 65, 32, 61, 32, 97, 99,111,115, 40,110,118, 41, 59, 10, 10, 9, 9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32, +110,111,114,109, 97,108,105,122,101, 40,108, 32, 45, 32,114,101, 97,108,110,108, 42,110, 41, 59, 10, 9, 9,118,101, 99, 51, 32, + 86,105,101,119, 95, 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10, 9, + 9,102,108,111, 97,116, 32,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, + 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10, 9, 9,105,102, 40, 76,105, +116, 95, 65, 32, 62, 32, 86,105,101,119, 95, 65, 41, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9, + 9, 98, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10, 9, 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9, 97, 32, 61, + 32, 86,105,101,119, 95, 65, 59, 10, 9, 9, 9, 98, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9,125, 10, 10, 9, 9,102,108, +111, 97,116, 32, 65, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, + 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10, 9, 9,102,108, +111, 97,116, 32, 66, 32, 61, 32, 48, 46, 52, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111, +117,103,104, 42,114,111,117,103,104, 41, 32, 43, 32, 48, 46, 48, 57, 41, 41, 59, 10, 10, 9, 9, 98, 32, 42, 61, 32, 48, 46, 57, + 53, 59, 10, 9, 9,105,115, 32, 61, 32,110,108, 42, 40, 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, + 41, 32, 42, 32,116, 97,110, 40, 98, 41, 41, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100, +105,102,102,117,115,101, 95,116,111,111,110, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, + 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, + 40,110, 44, 32,108, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, + 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32,115,105,122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115, +101, 32,105,102, 40, 97,110,103, 32, 62, 32, 40,115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116, +115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48, 41, 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105, +115, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, + 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, + 32,100, 97,114,107,110,101,115,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,102, 40,110, +108, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, + 32,123, 10, 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, + 46, 48, 41, 59, 10, 10, 9, 9,105,102, 40,100, 97,114,107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10, 9, 9, 9,105, +115, 32, 61, 32,110,108, 42,112,111,119, 40,109, 97,120, 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107, +110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112, +111,119, 40, 49, 46, 48, 48, 48, 49, 32, 45, 32,110,118, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, + 10, 9,125, 10,125, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105, +101,119, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,102,108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, + 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 49, 44, 32,116, 50, 59, 10, 9,102,108,111, 97,116, 32,102,102, 97, 99, + 59, 10, 10, 9,105,102, 40,102, 97, 99, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, + 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, + 10, 9, 9,105,102, 40,116, 49, 62, 48, 46, 48, 41, 32, 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10, 9, 9,101,108,115, +101, 32,116, 50, 61, 32, 49, 46, 48, 45,116, 49, 59, 10, 10, 9, 9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, + 45,103,114, 97,100, 41, 42,112,111,119, 40,116, 50, 44, 32,102, 97, 99, 41, 59, 10, 10, 9, 9,105,102, 40,116, 50, 60, 48, 46, + 48, 41, 32,102,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, + 32,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10, 9, +125, 10, 10, 9,114,101,116,117,114,110, 32,102,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100, +105,102,102,117,115,101, 95,102,114,101,115,110,101,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, + 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, + 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32,102,114,101,115,110,101, +108, 95,102, 97, 99, 40,108,118, 44, 32,118,110, 44, 32,102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,115,104, 97,100,101, 95, 99,117, 98,105, 99, 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,105,115, 41, 10,123, 10, 9,105,102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, + 41, 10, 9, 9,111,117,116,105,115, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32, +105,115, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32, +115,104, 97,100,101, 95,118,105,115,105,102, 97, 99, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115, +105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,114,101,102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, + 41, 10,123, 10, 9, 47, 42,105,102, 40,105, 32, 62, 32, 48, 46, 48, 41, 42, 47, 10, 9, 9,111,117,116,105, 32, 61, 32,109, 97, +120, 40,105, 42,118,105,115,105,102, 97, 99, 42,114,101,102,108, 44, 32, 48, 46, 48, 41, 59, 10, 9, 47, 42,101,108,115,101, 10, + 9, 9,111,117,116,105, 32, 61, 32,105, 59, 42, 47, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103, +101,110,116, 95,118, 95,115,112,101, 99, 40,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, +110, 41, 10,123, 10, 9,118,110, 32, 61, 32,116, 97,110,103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97, +100,100, 95,116,111, 95,100,105,102,102,117,115,101, 40,102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, + 99,111,108, 44, 32,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10, +123, 10, 9,105,102, 40,105, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, + 99,111,108, 42, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, + 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109, +105, 95,115,112,101, 99, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105, +101,119, 44, 32,102,108,111, 97,116, 32,115,112,101, 99, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97, +116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,108,118, 32, 43, 61, + 32,118,105,101,119, 59, 10, 9,108,118, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10, 9,116, 32, + 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59, 10, 9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, + 10, 10, 9,116, 32, 61, 32,118,105,115,105,102, 97, 99, 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32, +110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111, +114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97, +120, 40,100,111,116, 40,104, 44, 32,110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,112, +111,119, 40,114,115,108,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111, +111,107,116,111,114,114, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, + 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, + 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, + 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 10, 9,105,102, 40,110,104, 32, + 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108, +115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, + 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116, 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, + 59, 10, 10, 9, 9,105, 32, 61, 32,105, 47, 40, 48, 46, 49, 43,110,118, 41, 59, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, + 32,105, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40, +118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101, +102,114, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, + 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,115,112, +101, 99, 95,112,111,119,101,114, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, + 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, + 48, 48, 46, 48, 41, 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112, +101, 99, 95,112,111,119,101,114, 41, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, + 32, 49, 48, 46, 48, 47,115,112,101, 99, 95,112,111,119,101,114, 59, 10, 10, 9, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111, +114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, + 40,110, 44, 32,104, 41, 59, 10, 9, 9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, 9,115,112,101, 99, +102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9,102,108,111, 97,116, + 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 9, 9, 9,102, +108,111, 97,116, 32,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 9, 9, 9,105,102, 40,110,108, 32, 60, 61, + 32, 48, 46, 48, 49, 41, 32,123, 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 9,125, + 10, 9, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111, +116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, + 46, 48, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, + 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 99, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, + 10, 9, 9, 9, 9,102,108,111, 97,116, 32,103, 32, 61, 32, 48, 46, 48, 59, 10, 10, 9, 9, 9, 9,105,102, 40, 97, 32, 60, 32, + 98, 32, 38, 38, 32, 97, 32, 60, 32, 99, 41, 32,103, 32, 61, 32, 97, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 98, + 32, 60, 32, 97, 32, 38, 38, 32, 98, 32, 60, 32, 99, 41, 32,103, 32, 61, 32, 98, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105, +102, 40, 99, 32, 60, 32, 97, 32, 38, 38, 32, 99, 32, 60, 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10, 9, 9, 9, 9,102,108, +111, 97,116, 32,112, 32, 61, 32,115,113,114,116, 40, 40, 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, + 40,118,104, 42,118,104, 41, 45, 49, 46, 48, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40, +112, 45,118,104, 41, 42, 40,112, 45,118,104, 41, 41, 47, 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, + 49, 46, 48, 43, 40, 40, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43, +118,104, 41, 41, 45, 49, 46, 48, 41, 41, 47, 40, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40, +118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 41, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97,110, +103, 32, 61, 32, 97, 99,111,115, 40,110,104, 41, 59, 10, 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, + 40,102, 42,103, 42,101,120,112, 95, 98,108,101,110,100,101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, + 48, 42,115,112,101, 99, 95,112,111,119,101,114, 42,115,112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, + 59, 10, 9, 9, 9,125, 10, 9, 9,125, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100, +105,115,111, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, + 32,102,108,111, 97,116, 32,114,109,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, + 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108, +111, 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, + 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, + 41, 59, 10, 9,102,108,111, 97,116, 32,110,108, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, + 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, + 41, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,108,112,104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, + 49, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 61, 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, + 80, 73, 42, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, + 97,110,103,108,101, 42, 97,110,103,108,101, 41, 47, 40, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114, +116, 40,110,118, 42,110,108, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115, +112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97, +116, 32,115,105,122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, +108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, + 10, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97, +110,103, 32, 60, 32,115,105,122,101, 41, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, + 97,110,103, 32, 62, 61, 32, 40,115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111, +116,104, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,115,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,114,115,108, +116, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, + 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100, +101, 95,115,112,101, 99, 95, 97,114,101, 97, 95,105,110,112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102, +108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10, +123, 10, 9,111,117,116,115,112,101, 99,102, 97, 99, 32, 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10, +118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, + 32,102,108,111, 97,116, 32,115,112,101, 99, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97, +116, 32,115,112,101, 99,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,116, 32, 61, 32,115, +104, 97,100,102, 97, 99, 42,115,112,101, 99, 42,118,105,115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10, +118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, + 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99, 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42, +115,112,101, 99, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, + 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, + 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111, +105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, + 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, + 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118, +111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, + 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9, +111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 32, 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, + 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97, +100,101, 95,109, 97,100,100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99, +111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, + 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, + 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, + 32,102, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, +123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105, +100, 32,115,104, 97,100,101, 95,109,117,108, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, + 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99, +111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117, +101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32, +111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10, +118,111,105,100, 32,115,104, 97,100,101, 95,111, 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, + 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, + 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111, +108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, + 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, + 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 49, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110, +108,121, 95,115,104, 97,100,111,119, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, + 44, 32,102,108,111, 97,116, 32,101,110,101,114,103,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97, +100,102, 97, 99, 41, 10,123, 10, 9,111,117,116,115,104, 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, + 49, 46, 48, 32, 45, 32,115,104, 97,100,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110, +108,121, 95,115,104, 97,100,111,119, 95,100,105,102,102,117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, + 32,118,101, 99, 51, 32,114,103, 98, 44, 32,118,101, 99, 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, +117,116,100,105,102,102, 41, 10,123, 10, 9,111,117,116,100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, + 40,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100, +101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 95,115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97, +100,102, 97, 99, 44, 32,118,101, 99, 51, 32,115,112,101, 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111, +117,116, 32,118,101, 99, 52, 32,111,117,116,115,112,101, 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99, 32, 61, 32,115,112, +101, 99, 32, 45, 32,118,101, 99, 52, 40,115,112,101, 99,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,116,101,115,116, 95,115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, + 44, 32,115, 97,109,112,108,101,114, 50, 68, 83,104, 97,100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, + 52, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97, +115, 44, 32,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10, +123, 10, 9,105,102, 40,105,110,112, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32, 48, + 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111, +119,112,101,114,115,109, 97,116, 42,118,101, 99, 52, 40,114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9, 9, 47, 47,102,108, +111, 97,116, 32, 98,105, 97,115, 32, 61, 32, 40, 49, 46, 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111, +119, 98,105, 97,115, 59, 10, 9, 9, 99,111, 46,122, 32, 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, + 59, 10, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32,115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111, +119,109, 97,112, 44, 32, 99,111, 41, 46,120, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120, +112,111,115,117,114,101, 95, 99,111,114,114,101, 99,116, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108, +105,110,102, 97, 99, 44, 32,102,108,111, 97,116, 32,108,111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, +101,120,112, 40, 99,111,108, 42,108,111,103,102, 97, 99, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, +109,105,115,116, 95,102, 97, 99,116,111,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115, +116, 97, 44, 32,102,108,111, 97,116, 32,109,105,115,116,100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121, +112,101, 44, 32,102,108,111, 97,116, 32,109,105,115,105, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, + 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, 44, 32,122, 99,111,114, 59, 10, 10, 9,122, 99,111,114, 32, 61, 32, 40, +103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, + 41, 63, 32,108,101,110,103,116,104, 40, 99,111, 41, 58, 32, 45, 99,111, 91, 50, 93, 59, 10, 9, 10, 9,102, 97, 99, 32, 61, 32, + 99,108, 97,109,112, 40, 40,122, 99,111,114, 45,109,105,115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, + 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, + 97, 99, 32, 42, 61, 32,102, 97, 99, 59, 10, 9,101,108,115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, + 49, 46, 48, 41, 59, 10, 9,101,108,115,101, 32,102, 97, 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10, 9,111, +117,116,102, 97, 99, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115, +105, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, + 32,104,111,114, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, + 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, + 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, + 99,111,108, 46,114,103, 98, 44, 32,102, 97, 99, 41, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115, +104, 97,100,101, 95, 97,108,112,104, 97, 95,111,112, 97,113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111, +108, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, + 95,111, 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111, +117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, + 40, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105, +101,108,101, 99,116,114,105, 99, 40,118,101, 99, 51, 32, 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114, +109, 97,108, 44, 32,102,108,111, 97,116, 32,101,116, 97, 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, + 32,102,114,101,115,110,101,108, 32,114,101,102,108,101, 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112, +108,105, 99,105,116,108,121, 32, 99,111,109,112,117,116,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102, +114, 97, 99,116,101,100, 32,100,105,114,101, 99,116,105,111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, + 61, 32, 97, 98,115, 40,100,111,116, 40, 73,110, 99,111,109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, + 32, 32,102,108,111, 97,116, 32,103, 32, 61, 32,101,116, 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, + 42, 32, 99, 59, 10, 32, 32, 32, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, + 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, + 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116, 32, 65, 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, + 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116, 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, + 46, 48, 41, 47, 40, 99, 32, 42, 40,103, 32, 45, 32, 99, 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114, +101,115,117,108,116, 32, 61, 32, 48, 46, 53, 32, 42, 32, 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, + 66, 41, 59, 10, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108, +116, 32, 61, 32, 49, 46, 48, 59, 32, 32, 47, 42, 32, 84, 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99, +111,109,112,111,110,101,110,116, 41, 32, 42, 47, 10, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, + 10,125, 10, 10,102,108,111, 97,116, 32,104,121,112,111,116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, + 41, 10,123, 10, 9,114,101,116,117,114,110, 32,115,113,114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, + 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, + 84, 83, 32, 51, 10, 10, 47, 42, 32, 98,115,100,102,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100, +102, 95,100,105,102,102,117,115,101, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103, +104,110,101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10, +123, 10, 9, 47, 42, 32, 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10, 9,118,101, 99, 51, 32, 76, 32, 61, + 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103, +104,116,115, 32, 42, 47, 10, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, + 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116, +105,111,110, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, + 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, + 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 10, 9, 9,102, +108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115, +105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,100,105,102,102,117, +115,101, 42, 98,115,100,102, 59, 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111, +108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, + 95,103,108,111,115,115,121, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110, +101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101, +115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32, 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10, 9,118,101, + 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, + 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, + 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, + 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111, +115,105,116,105,111,110, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83, +111,117,114, 99,101, 91,105, 93, 46,104, 97,108,102, 86,101, 99,116,111,114, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32, +108,105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, + 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,115,112,101, 99, +117,108, 97,114, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,115,112,101, 99,117,108, 97, +114, 46,114,103, 98, 59, 10, 10, 9, 9, 47, 42, 32,119,101, 32,109,105,120, 32,105,110, 32,115,111,109,101, 32,100,105,102,102, +117,115,101, 32,115,111, 32,108,111,119, 32,114,111,117,103,104,110,101,115,115, 32,115,116,105,108,108, 32,115,104,111,119,115, + 32,117,112, 32, 42, 47, 10, 9, 9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32, 48, 46, 53, 42,112,111,119, 40,109, 97, +120, 40,100,111,116, 40, 78, 44, 32, 72, 41, 44, 32, 48, 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104,110,101,115,115, + 41, 59, 10, 9, 9, 98,115,100,102, 32, 43, 61, 32, 48, 46, 53, 42,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104, +116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95, +115,112,101, 99,117,108, 97,114, 42, 98,115,100,102, 59, 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, + 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100, +101, 95, 98,115,100,102, 95, 97,110,105,115,111,116,114,111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102, +108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, + 86, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117, 108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, + 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115, +100,102, 95,103,108, 97,115,115, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, +110,101,115,115, 44, 32,102,108,111, 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, + 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100, +105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, + 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,108,117, 99,101,110,116, 40,118,101, 99, + 52, 32, 99,111,108,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, + 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, + 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, + 95,116,114, 97,110,115,112, 97,114,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, + 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32,114,105,103,104,116, + 32, 42, 47, 10, 9,114,101,115,117,108,116, 46,114, 32, 61, 32, 99,111,108,111,114, 46,114, 59, 10, 9,114,101,115,117,108,116, + 46,103, 32, 61, 32, 99,111,108,111,114, 46,103, 59, 10, 9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99,111,108,111,114, 46, + 98, 59, 10, 9,114,101,115,117,108,116, 46, 97, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, + 95, 98,115,100,102, 95,118,101,108,118,101,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115, +105,103,109, 97, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, + 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10, 47, 42, 32,101,109,105,115,115,105,111,110, 32, 42, 47, 10, 10,118, 111,105,100, 32,110,111,100,101, 95,101,109,105,115,115,105,111,110, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108, 111, 97,116, 32,115,116,114,101,110,103,116,104, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114, diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c index cf2148bb341..cbc82969588 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -31,6 +31,7 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_in[]= { { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, "Roughness", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; From d6e050874629384f9907b3283503cfe4abaeca45 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 14 Nov 2011 17:33:32 +0000 Subject: [PATCH 060/203] Text Editor: implement space-as-tab navigation When "use tab as space" is on we will jump the spaces as if they were one single tab when navigating (left/right). Tabsize still is hardcoded to 4, but this is a separate design issue left for another patch. * patch done in the airplane while expaining the Text Editor code for a potencial new coder @ Blender PRO 2011 * --- source/blender/blenkernel/intern/text.c | 47 +++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index e8be0bb2608..5735a95764b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -796,6 +796,7 @@ void txt_move_left(Text *text, short sel) { TextLine **linep; int *charp, oundoing= undoing; + int tabsize = 1, i=0; if (!text) return; if(sel) txt_curs_sel(text, &linep, &charp); @@ -803,14 +804,34 @@ void txt_move_left(Text *text, short sel) if (!*linep) return; undoing= 1; + + // do nice left only if there are only spaces + // TXT_TABSIZE hardcoded in DNA_text_types.h + if (text->flags & TXT_TABSTOSPACES) { + tabsize = TXT_TABSIZE; + + if (*charp < tabsize) + tabsize = *charp; + else { + for (i=0;i<(*charp);i++) + if ((*linep)->line[i] != ' ') { + tabsize = 1; + break; + } + // if in the middle of the space-tab + if ((*charp) % tabsize != 0) + tabsize = ((*charp) % tabsize); + } + } + if (*charp== 0) { if ((*linep)->prev) { txt_move_up(text, sel); *charp= (*linep)->len; } - } else { - (*charp)--; } + else (*charp)-= tabsize; + undoing= oundoing; if(!undoing) txt_undo_add_op(text, sel?UNDO_SLEFT:UNDO_CLEFT); @@ -821,6 +842,7 @@ void txt_move_right(Text *text, short sel) { TextLine **linep; int *charp, oundoing= undoing; + int tabsize=1, i=0; if (!text) return; if(sel) txt_curs_sel(text, &linep, &charp); @@ -828,13 +850,32 @@ void txt_move_right(Text *text, short sel) if (!*linep) return; undoing= 1; + + // do nice right only if there are only spaces + // spaces hardcoded in DNA_text_types.h + if (text->flags & TXT_TABSTOSPACES) { + tabsize = TXT_TABSIZE; + + if ((*charp) + tabsize > (*linep)->len) + tabsize = 1; + else { + for (i=0;i<(*charp) + tabsize - ((*charp) % tabsize);i++) + if ((*linep)->line[i] != ' ') { + tabsize = 1; + break; + } + // if in the middle of the space-tab + tabsize -= (*charp) % tabsize; + } + } + if (*charp== (*linep)->len) { if ((*linep)->next) { txt_move_down(text, sel); *charp= 0; } } else { - (*charp)++; + (*charp)+=tabsize; } undoing= oundoing; if(!undoing) txt_undo_add_op(text, sel?UNDO_SRIGHT:UNDO_CRIGHT); From 21fa7e0b866e6ff3f27e38a23a078e5afbb2266b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 14 Nov 2011 19:13:52 +0000 Subject: [PATCH 061/203] Some UI messages fixes and tweaks in recent merges (found while translating in french). --- intern/cycles/blender/addon/properties.py | 2 +- .../editors/physics/dynamicpaint_ops.c | 4 +- .../makesrna/intern/rna_dynamicpaint.c | 38 +++++++++---------- source/blender/makesrna/intern/rna_texture.c | 4 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 5a56240865a..cd3ded2200d 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -108,7 +108,7 @@ class CyclesCameraSettings(bpy.types.PropertyGroup): cls.aperture_size = FloatProperty(name="Aperture Size", description="Radius of the aperture for depth of field", default=0.0, min=0.0, max=10.0) - cls.aperture_blades = IntProperty(name="Aperture Blades", description="Number of blades in aperture for polygonal bokeh (need 3 or more)", + cls.aperture_blades = IntProperty(name="Aperture Blades", description="Number of blades in aperture for polygonal bokeh (at least 3)", default=0, min=0, max=100) cls.aperture_rotation = FloatProperty(name="Aperture Rotation", description="Rotation of blades in aperture", default=0, soft_min=-math.pi, soft_max=math.pi, subtype='ANGLE') diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 6739e297309..a12a9c8720b 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -183,7 +183,7 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot) /* identifiers */ ot->name= "Toggle Type Active"; ot->idname= "DPAINT_OT_type_toggle"; - ot->description = "Toggles whether given type is active or not"; + ot->description = "Toggle whether given type is active or not"; /* api callbacks */ ot->exec= type_toggle_exec; @@ -251,7 +251,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot) /* identifiers */ ot->name= "Toggle Output Layer"; ot->idname= "DPAINT_OT_output_toggle"; - ot->description = "Adds or removes Dynamic Paint output data layer"; + ot->description = "Add or remove Dynamic Paint output data layer"; /* api callbacks */ ot->exec= output_toggle_exec; diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 640361e2b2e..10042f5392a 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -477,16 +477,16 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop= RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG); - RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying. Makes high values to fade faster than low values"); + RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to fade faster than low values)"); prop= RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG); - RNA_def_property_ui_text(prop, "Slow", "Use logarithmic dissolve. Makes high values to fade faster than low values"); + RNA_def_property_ui_text(prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)"); prop= RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD); - RNA_def_property_ui_text(prop, "Use Spread", "Processes spread effect. Spreads wet paint around surface"); + RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset"); prop= RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE); @@ -504,13 +504,13 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop= RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP); - RNA_def_property_ui_text(prop, "Use Drip", "Processes drip effect. Drips wet paint to gravity direction"); + RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset"); prop= RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK); - RNA_def_property_ui_text(prop, "Use Shrink", "Processes shrink effect. Shrinks paint areas"); + RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset"); prop= RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE); @@ -528,13 +528,13 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "drip_vel"); RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Velocity", "Defines how much surface velocity affects dripping"); + RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping"); prop= RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drip_acc"); RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_ui_text(prop, "Acceleration", "Defines how much surface acceleration affects dripping"); + RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping"); /* * Output settings @@ -542,7 +542,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA); - RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiplies color by alpha. (Recommended for Blender input)"); + RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)"); prop= RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "image_output_path"); @@ -588,7 +588,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.00, 50.0); RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2); - RNA_def_property_ui_text(prop, "Max Displace", "Maximum level of depth intersection in object space. Use 0.0 to disable"); + RNA_def_property_ui_text(prop, "Max Displace", "Maximum level of depth intersection in object space (use 0.0 to disable)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); prop= RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE); @@ -639,7 +639,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop= RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS); - RNA_def_property_ui_text(prop, "Open Borders", "Passes waves through mesh edges"); + RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges"); /* cache */ @@ -651,7 +651,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) /* is cache used */ prop= RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); - RNA_def_property_ui_text(prop, "Uses Cache", ""); + RNA_def_property_ui_text(prop, "Use Cache", ""); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE); } @@ -735,7 +735,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mat"); - RNA_def_property_ui_text(prop, "Material", "Material to use. If not defined, material linked to the mesh is used"); + RNA_def_property_ui_text(prop, "Material", "Material to use (if not defined, material linked to the mesh is used)"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); @@ -747,7 +747,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "wetness"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2); - RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness. Visible in wetmap. Some effects only affect wet paint"); + RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness, visible in wetmap (some effects only affect wet paint)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); prop= RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE); @@ -768,11 +768,11 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.00, 50.0); RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2); - RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves. Use 0.0 to disable"); + RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves (use 0.0 to disable)"); prop= RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE); - RNA_def_property_ui_text(prop, "Do Smudge", "Makes this brush to smudge existing paint as it moves"); + RNA_def_property_ui_text(prop, "Do Smudge", "Make this brush to smudge existing paint as it moves"); prop= RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 1.0); @@ -783,7 +783,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "max_velocity"); RNA_def_property_range(prop, 0.0001, 10.0); RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2); - RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence. (Blender units per frame)"); + RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)"); prop= RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA); @@ -819,7 +819,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA); - RNA_def_property_ui_text(prop, "Only Use Alpha", "Only reads color ramp alpha"); + RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); prop= RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE); @@ -837,7 +837,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ray_dir"); RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir); - RNA_def_property_ui_text(prop, "Ray Direction", "Defines ray direction to use for projection. If brush object is located in that direction it's painted"); + RNA_def_property_ui_text(prop, "Ray Direction", "Ray direction to use for projection (if brush object is located in that direction it's painted)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); prop= RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE); @@ -864,7 +864,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD); - RNA_def_property_ui_text(prop, "Use Particle Radius", "Uses radius from particle settings"); + RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier"); prop= RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index dfbfac75f8c..e2c105e9ba8 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1874,9 +1874,9 @@ static void rna_def_texture_ocean(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem ocean_output_items[] = { - {TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Outputs XYZ displacement in RGB channels"}, + {TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Output XYZ displacement in RGB channels"}, //{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"}, // these are in nor channel now - {TEX_OCN_FOAM, "FOAM", 0, "Foam", "Outputs Foam (wave overlap) amount in single channel"}, + {TEX_OCN_FOAM, "FOAM", 0, "Foam", "Output Foam (wave overlap) amount in single channel"}, {TEX_OCN_JPLUS, "JPLUS", 0, "Eigenvalues", "Positive Eigenvalues"}, {TEX_OCN_EMINUS, "EMINUS", 0, "Eigenvectors (-)", "Negative Eigenvectors"}, {TEX_OCN_EPLUS, "EPLUS", 0, "Eigenvectors (+)", "Positive Eigenvectors"}, From ff82aa8677236ace9686681ee64f06e191d171c3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 14 Nov 2011 19:44:49 +0000 Subject: [PATCH 062/203] Fix for uninitialized usage of spos in AUD_LinearResampleReader::read Patch is verified by neXyon --- intern/audaspace/intern/AUD_LinearResampleReader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/intern/audaspace/intern/AUD_LinearResampleReader.cpp b/intern/audaspace/intern/AUD_LinearResampleReader.cpp index 08644d0a119..aff62d7c3aa 100644 --- a/intern/audaspace/intern/AUD_LinearResampleReader.cpp +++ b/intern/audaspace/intern/AUD_LinearResampleReader.cpp @@ -155,6 +155,9 @@ void AUD_LinearResampleReader::read(int& length, bool& eos, sample_t* buffer) m_cache_ok = true; } + if(length == 0) + return; + for(int channel = 0; channel < m_channels; channel++) { for(int i = 0; i < length; i++) From 2ab2423b06a81b8bccbe496f33a8a1fc8a8204ae Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 19:45:21 +0000 Subject: [PATCH 063/203] Cycles: * Fix #29257: nan-pixels with zero roughness for glass/glossy. * Fix #29239: crash with border rendering, this is not working yet, but should no longer crash now. * Show object name in 3d view rendered draw type. * Attempt to improve Sample as Light option description. --- intern/cycles/blender/addon/engine.py | 9 +++++++-- intern/cycles/blender/addon/properties.py | 2 +- intern/cycles/kernel/svm/bsdf_microfacet.h | 4 ++-- source/blender/editors/space_view3d/view3d_draw.c | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 097909ca058..d0f0d395810 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -50,11 +50,16 @@ def free(engine): def render(engine): import bcycles - bcycles.render(engine.session) + if "session" in dir(engine): + bcycles.render(engine.session) def update(engine, data, scene): import bcycles - bcycles.sync(engine.session) + if scene.render.use_border: + engine.report({'ERROR'}, "Border rendering not supported yet") + free(engine) + else: + bcycles.sync(engine.session) def draw(engine, region, v3d, rv3d): import bcycles diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index cd3ded2200d..bcd3f7d1eac 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -121,7 +121,7 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup): @classmethod def register(cls): bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles material settings") - cls.sample_as_light = BoolProperty(name="Sample as Light", description="Use direct light sampling, to reduce noise for small or strong emitting materials", default=True) + cls.sample_as_light = BoolProperty(name="Sample as Lamp", description="Use direct light sampling for this material, disabling may reduce overall noise for large objects that emit little light compared to other light sources", default=True) cls.homogeneous_volume = BoolProperty(name="Homogeneous Volume", description="When using volume rendering, assume volume has the same density everywhere, for faster rendering", default=False) @classmethod diff --git a/intern/cycles/kernel/svm/bsdf_microfacet.h b/intern/cycles/kernel/svm/bsdf_microfacet.h index 3acd3ba4c85..077b642c3c1 100644 --- a/intern/cycles/kernel/svm/bsdf_microfacet.h +++ b/intern/cycles/kernel/svm/bsdf_microfacet.h @@ -45,7 +45,7 @@ typedef struct BsdfMicrofacetGGXClosure { __device void bsdf_microfacet_ggx_setup(ShaderData *sd, ShaderClosure *sc, float ag, float eta, bool refractive) { - float m_ag = clamp(ag, 1e-5f, 1.0f); + float m_ag = clamp(ag, 1e-4f, 1.0f); float m_eta = eta; sc->data0 = m_ag; @@ -270,7 +270,7 @@ typedef struct BsdfMicrofacetBeckmannClosure { __device void bsdf_microfacet_beckmann_setup(ShaderData *sd, ShaderClosure *sc, float ab, float eta, bool refractive) { - float m_ab = clamp(ab, 1e-5f, 1.0f); + float m_ab = clamp(ab, 1e-4f, 1.0f); float m_eta = eta; sc->data0 = m_ab; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index edcaed43de6..7ce758d4f47 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2878,6 +2878,10 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha else draw_view_icon(rv3d); + ob= OBACT; + if(U.uiflag & USER_DRAWVIEWINFO) + draw_selected_name(scene, ob); + if(rv3d->render_engine) { view3d_main_area_draw_engine_info(rv3d, ar); return; @@ -2899,10 +2903,6 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha BLF_draw_default_ascii(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, tstr[0]?tstr : grid_unit, sizeof(tstr)); /* XXX, use real length */ } - - ob= OBACT; - if(U.uiflag & USER_DRAWVIEWINFO) - draw_selected_name(scene, ob); } void view3d_main_area_draw(const bContext *C, ARegion *ar) From bc98d4e383d21834d074c64adb85ec4de7c84a7c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 20:26:23 +0000 Subject: [PATCH 064/203] Fix #29238: crash with node dependency loop. --- source/blender/editors/space_node/node_templates.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index fedb12f747c..c99a0be15dc 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -552,6 +552,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *lnode; char label[UI_MAX_NAME_STR]; int indent = (depth > 1)? 2*(depth - 1): 0; + int dependency_loop; if(input->flag & SOCK_UNAVAIL) return; @@ -560,6 +561,10 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, node->flag |= NODE_TEST; lnode = (input->link)? input->link->fromnode: NULL; + dependency_loop = (lnode && (lnode->flag & NODE_TEST)); + if(dependency_loop) + lnode = NULL; + /* socket RNA pointer */ RNA_pointer_create(&ntree->id, &RNA_NodeSocket, input, &inputptr); @@ -593,7 +598,11 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bt= block->buttons.last; bt->flag= UI_TEXT_LEFT; - if(lnode) { + if(dependency_loop) { + row = uiLayoutRow(split, 0); + uiItemL(row, "Dependency Loop", ICON_ERROR); + } + else if(lnode) { /* input linked to a node */ uiTemplateNodeLink(split, ntree, node, input); From 3442c16c09b31a23f45b23be72e6eb5ba02c7bbf Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Nov 2011 20:39:53 +0000 Subject: [PATCH 065/203] Fix #29249: mapping node not keyable anymore, restore RNA to what it was before Cycles change, generating RNA paths for this is a bit complicated. --- intern/cycles/blender/blender_shader.cpp | 11 ++++- source/blender/editors/space_node/drawnode.c | 15 +++--- source/blender/makesrna/intern/rna_nodetree.c | 48 +++++++++++++++++-- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 6f78fe1f0d4..a6ce0e9bfa8 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -100,7 +100,7 @@ static float get_node_output_value(BL::Node b_node, const string& name) static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping) { mapping->translation = get_float3(b_mapping.location()); - mapping->rotation = get_float3(b_mapping.rotation())*(M_PI/180.0f); /* in degrees! */ + mapping->rotation = get_float3(b_mapping.rotation()); mapping->scale = get_float3(b_mapping.scale()); mapping->x_mapping = (TextureMapping::Mapping)b_mapping.mapping_x(); @@ -108,6 +108,13 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping) mapping->z_mapping = (TextureMapping::Mapping)b_mapping.mapping_z(); } +static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_mapping) +{ + mapping->translation = get_float3(b_mapping.location()); + mapping->rotation = get_float3(b_mapping.rotation()); + mapping->scale = get_float3(b_mapping.scale()); +} + static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *b_group_node, BL::ShaderNode b_node) { ShaderNode *node = NULL; @@ -174,7 +181,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node * BL::ShaderNodeMapping b_mapping_node(b_node); MappingNode *mapping = new MappingNode(); - get_tex_mapping(&mapping->tex_mapping, b_mapping_node.mapping()); + get_tex_mapping(&mapping->tex_mapping, b_mapping_node); node = mapping; break; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index e2e47338eee..92592a7c071 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -947,28 +947,27 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - PointerRNA mappingptr = RNA_pointer_get(ptr, "mapping"); uiLayout *row; uiItemL(layout, "Location:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "location", 0, "", ICON_NONE); + uiItemR(row, ptr, "location", 0, "", ICON_NONE); uiItemL(layout, "Rotation:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "rotation", 0, "", ICON_NONE); + uiItemR(row, ptr, "rotation", 0, "", ICON_NONE); uiItemL(layout, "Scale:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "scale", 0, "", ICON_NONE); + uiItemR(row, ptr, "scale", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "use_min", 0, "Min", ICON_NONE); - uiItemR(row, &mappingptr, "min", 0, "", ICON_NONE); + uiItemR(row, ptr, "use_min", 0, "Min", ICON_NONE); + uiItemR(row, ptr, "min", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "use_max", 0, "Max", ICON_NONE); - uiItemR(row, &mappingptr, "max", 0, "", ICON_NONE); + uiItemR(row, ptr, "use_max", 0, "Max", ICON_NONE); + uiItemR(row, ptr, "max", 0, "", ICON_NONE); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 170cfcb103e..30889bb25f6 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -757,6 +757,13 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep return NULL; } +static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNode *node = ptr->data; + init_tex_mapping(node->storage); + rna_Node_update(bmain, scene, ptr); +} + #else static EnumPropertyItem prop_image_layer_items[] = { @@ -1097,12 +1104,43 @@ static void def_sh_material(StructRNA *srna) static void def_sh_mapping(StructRNA *srna) { PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); - prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "storage"); - RNA_def_property_struct_type(prop, "TexMapping"); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Mapping", "Texture coordinate mapping settings"); + prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "loc"); + RNA_def_property_ui_text(prop, "Location", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */ + RNA_def_property_float_sdna(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Rotation", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Scale", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "min"); + RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); + RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); + RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); } static void def_sh_geometry(StructRNA *srna) From 747f06d3d23e75bee048bd9957fbe44897ad0ad6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 02:58:01 +0000 Subject: [PATCH 066/203] set cycles scripts as pep8 & make some minor changes. also update sphinx doc generator. --- doc/python_api/sphinx_doc_gen.py | 3 + intern/cycles/blender/addon/__init__.py | 12 ++-- intern/cycles/blender/addon/engine.py | 15 ++++- intern/cycles/blender/addon/enums.py | 39 +++++++------ intern/cycles/blender/addon/presets.py | 10 +++- intern/cycles/blender/addon/properties.py | 18 ++++-- intern/cycles/blender/addon/ui.py | 69 +++++++++++++++++------ intern/cycles/blender/addon/xml.py | 10 +++- 8 files changed, 126 insertions(+), 50 deletions(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 36e092f85b7..9cbd6824bbb 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -589,6 +589,7 @@ def pycontext2sphinx(BASEPATH): "active_base": ("ObjectBase", False), "active_bone": ("Bone", False), "active_object": ("Object", False), + "active_operator": ("Operator", False), "active_pose_bone": ("PoseBone", False), "armature": ("Armature", False), "bone": ("Bone", False), @@ -597,6 +598,7 @@ def pycontext2sphinx(BASEPATH): "cloth": ("ClothModifier", False), "collision": ("CollisionModifier", False), "curve": ("Curve", False), + "dynamic_paint": ("DynamicPaintModifier", False), "edit_bone": ("EditBone", False), "edit_image": ("Image", False), "edit_object": ("Object", False), @@ -635,6 +637,7 @@ def pycontext2sphinx(BASEPATH): "speaker": ("Speaker", False), "texture": ("Texture", False), "texture_slot": ("MaterialTextureSlot", False), + "texture_user": ("ID", False), "vertex_paint_object": ("Object", False), "visible_bases": ("ObjectBase", True), "visible_bones": ("Object", True), diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index f5ea39b7e3c..ccb04eea0a8 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -16,10 +16,12 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + bl_info = { "name": "Cycles Render Engine", "author": "", - "version": (0,0), + "version": (0, 0), "blender": (2, 6, 0), "api": 41670, "location": "Info header, render engine menu", @@ -38,6 +40,7 @@ from cycles import xml from cycles import engine from cycles import presets + class CyclesRender(bpy.types.RenderEngine): bl_idname = 'CYCLES' bl_label = "Cycles" @@ -46,7 +49,7 @@ class CyclesRender(bpy.types.RenderEngine): def __init__(self): engine.init() self.session = None - + def __del__(self): engine.free(self) @@ -64,7 +67,7 @@ class CyclesRender(bpy.types.RenderEngine): # # def preview_render(self): # pass - + # viewport render def view_update(self, context): if not self.session: @@ -75,6 +78,7 @@ class CyclesRender(bpy.types.RenderEngine): def view_draw(self, context): engine.draw(self, context.region, context.space_data, context.region_data) + def register(): properties.register() ui.register() @@ -82,10 +86,10 @@ def register(): presets.register() bpy.utils.register_module(__name__) + def unregister(): xml.unregister() ui.unregister() properties.unregister() presets.unregister() bpy.utils.unregister_module(__name__) - diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index d0f0d395810..a32a9e91499 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -16,8 +16,11 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + import bpy + def init(): import bcycles import os.path @@ -27,7 +30,8 @@ def init(): bcycles.init(path, user_path) -def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0): + +def create(engine, data, scene, region=0, v3d=0, rv3d=0): import bcycles data = data.as_pointer() @@ -41,18 +45,21 @@ def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0): engine.session = bcycles.create(engine.as_pointer(), data, scene, region, v3d, rv3d) + def free(engine): - if "session" in dir(engine): + if hasattr(engine, "session"): if engine.session: import bcycles bcycles.free(engine.session) del engine.session + def render(engine): import bcycles if "session" in dir(engine): bcycles.render(engine.session) + def update(engine, data, scene): import bcycles if scene.render.use_border: @@ -61,6 +68,7 @@ def update(engine, data, scene): else: bcycles.sync(engine.session) + def draw(engine, region, v3d, rv3d): import bcycles v3d = v3d.as_pointer() @@ -69,11 +77,12 @@ def draw(engine, region, v3d, rv3d): # draw render image bcycles.draw(engine.session, v3d, rv3d) + def available_devices(): import bcycles return bcycles.available_devices() + def with_osl(): import bcycles return bcycles.with_osl() - diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py index 4aef2553050..463fdc19534 100644 --- a/intern/cycles/blender/addon/enums.py +++ b/intern/cycles/blender/addon/enums.py @@ -16,8 +16,11 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + from cycles import engine + def get_gpu_device(): available_devices = engine.available_devices() cuda = 'cuda' in available_devices @@ -28,32 +31,36 @@ def get_gpu_device(): gpu_string = "CUDA GPU" else: gpu_string = "OpenCL GPU" - + return gpu_string devices = ( -("CPU", "CPU", "Processor"), -("GPU", get_gpu_device(), "Graphics card")) + ("CPU", "CPU", "Processor"), + ("GPU", get_gpu_device(), "Graphics card"), + ) gpu_type = ( -("CUDA", "CUDA", "NVidia only"), -("OPENCL", "OpenCL (incomplete)", "")) + ("CUDA", "CUDA", "NVidia only"), + ("OPENCL", "OpenCL (incomplete)", ""), + ) shading_systems = ( -("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"), -("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU")) + ("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"), + ("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"), + ) displacement_methods = ( -("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"), -("TRUE", "True", "Use true displacement only, requires fine subdivision"), -("BOTH", "Both", "Combination of displacement and bump mapping")) + ("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"), + ("TRUE", "True", "Use true displacement only, requires fine subdivision"), + ("BOTH", "Both", "Combination of displacement and bump mapping"), + ) bvh_types = ( -("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"), -("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster")) + ("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"), + ("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"), + ) filter_types = ( -("BOX", "Box", "Box filter"), -("GAUSSIAN", "Gaussian", "Gaussian filter")) - - + ("BOX", "Box", "Box filter"), + ("GAUSSIAN", "Gaussian", "Gaussian filter"), + ) diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py index e5243b633be..e2836b2cc21 100644 --- a/intern/cycles/blender/addon/presets.py +++ b/intern/cycles/blender/addon/presets.py @@ -16,9 +16,12 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + from bl_operators.presets import AddPresetBase from bpy.types import Operator + class AddPresetIntegrator(AddPresetBase, Operator): '''Add an Integrator Preset''' bl_idname = "render.cycles_integrator_preset_add" @@ -41,13 +44,14 @@ class AddPresetIntegrator(AddPresetBase, Operator): ] preset_subdir = "cycles/integrator" - + + def register(): pass + def unregister(): pass - + if __name__ == "__main__": register() - diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index bcd3f7d1eac..0c7deb01ed8 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -16,6 +16,8 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + import bpy from bpy.props import * @@ -23,6 +25,7 @@ import math from cycles import enums + class CyclesRenderSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -30,7 +33,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): cls.device = EnumProperty(name="Device", description="Device to use for rendering", items=enums.devices, default="CPU") - + cls.gpu_type = EnumProperty(name="GPU Type", description="Processing system to use on the GPU", items=enums.gpu_type, default="CUDA") @@ -101,6 +104,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): def unregister(cls): del bpy.types.Scene.cycles + class CyclesCameraSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -112,11 +116,12 @@ class CyclesCameraSettings(bpy.types.PropertyGroup): default=0, min=0, max=100) cls.aperture_rotation = FloatProperty(name="Aperture Rotation", description="Rotation of blades in aperture", default=0, soft_min=-math.pi, soft_max=math.pi, subtype='ANGLE') - + @classmethod def unregister(cls): del bpy.types.Camera.cycles + class CyclesMaterialSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -128,6 +133,7 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup): def unregister(cls): del bpy.types.Material.cycles + class CyclesLampSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -138,6 +144,7 @@ class CyclesLampSettings(bpy.types.PropertyGroup): def unregister(cls): del bpy.types.Lamp.cycles + class CyclesWorldSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -147,6 +154,7 @@ class CyclesWorldSettings(bpy.types.PropertyGroup): def unregister(cls): del bpy.types.World.cycles + class CyclesVisibilitySettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -162,6 +170,7 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup): def unregister(cls): del bpy.types.Object.cycles_visibility + class CyclesMeshSettings(bpy.types.PropertyGroup): @classmethod def register(cls): @@ -181,6 +190,7 @@ class CyclesMeshSettings(bpy.types.PropertyGroup): del bpy.types.Curve.cycles del bpy.types.MetaBall.cycles + def register(): bpy.utils.register_class(CyclesRenderSettings) bpy.utils.register_class(CyclesCameraSettings) @@ -189,7 +199,8 @@ def register(): bpy.utils.register_class(CyclesWorldSettings) bpy.utils.register_class(CyclesVisibilitySettings) bpy.utils.register_class(CyclesMeshSettings) - + + def unregister(): bpy.utils.unregister_class(CyclesRenderSettings) bpy.utils.unregister_class(CyclesCameraSettings) @@ -198,4 +209,3 @@ def unregister(): bpy.utils.unregister_class(CyclesWorldSettings) bpy.utils.unregister_class(CyclesMeshSettings) bpy.utils.unregister_class(CyclesVisibilitySettings) - diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 7c7d4c81b89..6cebe3d24e4 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -16,6 +16,8 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + import bpy from bpy.types import Panel, Menu @@ -23,6 +25,7 @@ from bpy.types import Panel, Menu from cycles import enums from cycles import engine + class CYCLES_MT_integrator_presets(Menu): bl_label = "Integrator Presets" preset_subdir = "cycles/integrator" @@ -30,16 +33,18 @@ class CYCLES_MT_integrator_presets(Menu): COMPAT_ENGINES = {'CYCLES'} draw = Menu.draw_preset + class CyclesButtonsPanel(): bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "render" - + @classmethod def poll(cls, context): rd = context.scene.render return rd.engine == 'CYCLES' + class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): bl_label = "Integrator" bl_options = {'DEFAULT_CLOSED'} @@ -49,7 +54,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): scene = context.scene cscene = scene.cycles - + row = layout.row(align=True) row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label) row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN") @@ -87,7 +92,8 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): #row = col.row() #row.prop(cscene, "blur_caustics") #row.active = not cscene.no_caustics - + + class CyclesRender_PT_film(CyclesButtonsPanel, Panel): bl_label = "Film" @@ -99,7 +105,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel): split = layout.split() - col = split.column(); + col = split.column() col.prop(cscene, "film_exposure") col.prop(cscene, "film_transparent") @@ -109,6 +115,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel): if cscene.filter_type != 'BOX': sub.prop(cscene, "filter_width", text="Width") + class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): bl_label = "Performance" bl_options = {'DEFAULT_CLOSED'} @@ -142,6 +149,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): sub.prop(cscene, "debug_bvh_type", text="") sub.prop(cscene, "debug_use_spatial_splits") + class CyclesRender_PT_layers(CyclesButtonsPanel, Panel): bl_label = "Layers" bl_options = {'DEFAULT_CLOSED'} @@ -178,6 +186,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel): layout.prop(rl, "material_override", text="Material") + class Cycles_PT_post_processing(CyclesButtonsPanel, Panel): bl_label = "Post Processing" bl_options = {'DEFAULT_CLOSED'} @@ -196,6 +205,7 @@ class Cycles_PT_post_processing(CyclesButtonsPanel, Panel): col = split.column() col.prop(rd, "dither_intensity", text="Dither", slider=True) + class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel): bl_label = "Depth of Field" bl_context = "data" @@ -229,6 +239,7 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel): sub.prop(ccam, "aperture_blades", text="Blades") sub.prop(ccam, "aperture_rotation", text="Rotation") + class Cycles_PT_context_material(CyclesButtonsPanel, Panel): bl_label = "Surface" bl_context = "material" @@ -277,6 +288,7 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel): split.template_ID(space, "pin_id") split.separator() + class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel): bl_label = "Displacement" bl_context = "data" @@ -300,8 +312,9 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel): cdata = mball.cycles layout.prop(cdata, "displacement_method", text="Method") - layout.prop(cdata, "use_subdivision"); - layout.prop(cdata, "dicing_rate"); + layout.prop(cdata, "use_subdivision") + layout.prop(cdata, "dicing_rate") + class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): bl_label = "Ray Visibility" @@ -311,7 +324,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): ob = context.object - return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP' + return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP' def draw(self, context): layout = self.layout @@ -330,6 +343,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): col.prop(visibility, "transmission") col.prop(visibility, "shadow") + def find_node(material, nodetype): if material and material.node_tree: ntree = material.node_tree @@ -337,16 +351,18 @@ def find_node(material, nodetype): for node in ntree.nodes: if hasattr(node, 'type') and node.type == nodetype: return node - + return None + def find_node_input(node, name): for input in node.inputs: if input.name == name: return input - + return None + def panel_node_draw(layout, id, output_type, input_name): if not id.node_tree: layout.prop(id, "use_nodes", icon='NODETREE') @@ -359,10 +375,11 @@ def panel_node_draw(layout, id, output_type, input_name): layout.label(text="No output node.") else: input = find_node_input(node, input_name) - layout.template_node_view(ntree, node, input); - + layout.template_node_view(ntree, node, input) + return True + class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): bl_label = "Lamp" bl_context = "data" @@ -401,7 +418,8 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): layout.label(text="Not supported, interpreted as point lamp.") elif lamp.type == 'HEMI': layout.label(text="Not supported, interpreted as sun lamp.") - + + class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel): bl_label = "Nodes" bl_context = "data" @@ -417,6 +435,7 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel): if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'): layout.prop(lamp, "color") + class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): bl_label = "Surface" bl_context = "world" @@ -432,6 +451,7 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'): layout.prop(world, "horizon_color", text="Color") + class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" bl_context = "world" @@ -440,7 +460,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): world = context.world - return False # world and world.node_tree and CyclesButtonsPanel.poll(context) + return False # world and world.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -449,6 +469,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): world = context.world panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume') + class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel): bl_label = "Surface" bl_context = "material" @@ -464,6 +485,7 @@ class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel): if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'): layout.prop(mat, "diffuse_color") + class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" bl_context = "material" @@ -472,7 +494,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): mat = context.material - return False #mat and mat.node_tree and CyclesButtonsPanel.poll(context) + return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -485,6 +507,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): layout.prop(cmat, "homogeneous_volume") + class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel): bl_label = "Displacement" bl_context = "material" @@ -500,6 +523,7 @@ class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel): mat = context.material panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement') + class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel): bl_label = "Settings" bl_context = "material" @@ -523,6 +547,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel): col = split.column() col.prop(cmat, "sample_as_light") + class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): bl_label = "" bl_context = "texture" @@ -535,7 +560,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): tex = context.texture space = context.space_data pin_id = space.pin_id - use_pin_id = space.use_pin_id; + use_pin_id = space.use_pin_id user = context.texture_user node = context.texture_node @@ -555,7 +580,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): col.template_ID(space, "pin_id") elif user: col.template_ID(user, "texture", new="texture.new") - + if tex: row = split.row() row.prop(tex, "use_nodes", icon="NODETREE", text="") @@ -566,6 +591,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): split.label(text="Type:") split.prop(tex, "type", text="") + class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel): bl_label = "Nodes" bl_context = "texture" @@ -581,6 +607,7 @@ class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel): tex = context.texture panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color') + class CyclesTexture_PT_node(CyclesButtonsPanel, Panel): bl_label = "Node" bl_context = "texture" @@ -597,6 +624,7 @@ class CyclesTexture_PT_node(CyclesButtonsPanel, Panel): ntree = node.id_data layout.template_node_view(ntree, node, None) + class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel): bl_label = "Mapping" bl_context = "texture" @@ -628,6 +656,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel): row.prop(mapping, "mapping_y", text="") row.prop(mapping, "mapping_z", text="") + class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel): bl_label = "Color" bl_context = "texture" @@ -668,6 +697,7 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel): if mapping.use_color_ramp: layout.template_color_ramp(mapping, "color_ramp", expand=True) + def draw_device(self, context): scene = context.scene layout = self.layout @@ -686,6 +716,7 @@ def draw_device(self, context): if cscene.device == 'CPU' and engine.with_osl(): layout.prop(cscene, "shading_system") + def draw_pause(self, context): layout = self.layout scene = context.scene @@ -697,6 +728,7 @@ def draw_pause(self, context): cscene = scene.cycles layout.prop(cscene, "preview_pause", icon="PAUSE", text="") + def get_panels(): return [ bpy.types.RENDER_PT_render, @@ -752,17 +784,18 @@ def get_panels(): bpy.types.PARTICLE_PT_vertexgroups, bpy.types.PARTICLE_PT_custom_props] + def register(): bpy.types.RENDER_PT_render.append(draw_device) bpy.types.VIEW3D_HT_header.append(draw_pause) for panel in get_panels(): panel.COMPAT_ENGINES.add('CYCLES') - + + def unregister(): bpy.types.RENDER_PT_render.remove(draw_device) bpy.types.VIEW3D_HT_header.remove(draw_pause) for panel in get_panels(): panel.COMPAT_ENGINES.remove('CYCLES') - diff --git a/intern/cycles/blender/addon/xml.py b/intern/cycles/blender/addon/xml.py index 3713da09235..e64023f046b 100644 --- a/intern/cycles/blender/addon/xml.py +++ b/intern/cycles/blender/addon/xml.py @@ -16,6 +16,8 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# + # XML exporter for generating test files, not intended for end users import os @@ -24,6 +26,7 @@ from bpy_extras.io_utils import ExportHelper import xml.etree.ElementTree as etree import xml.dom.minidom as dom + def strip(root): root.text = None root.tail = None @@ -31,6 +34,7 @@ def strip(root): for elem in root: strip(elem) + def write(node, fname): strip(node) @@ -40,6 +44,7 @@ def write(node, fname): f = open(fname, "w") f.write(s) + class ExportCyclesXML(bpy.types.Operator, ExportHelper): '''''' bl_idname = "export_mesh.cycles_xml" @@ -82,18 +87,19 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper): verts += " " node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P}) - + # write to file write(node, filepath) return {'FINISHED'} + def register(): pass + def unregister(): pass if __name__ == "__main__": register() - From 502081879bee45d0def27e1290ffa45feb3fd6f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 03:48:25 +0000 Subject: [PATCH 067/203] remove unused OceanModifierData member & use smaller flags where possible --- source/blender/makesdna/DNA_modifier_types.h | 28 +++++++++++--------- source/blender/modifiers/intern/MOD_ocean.c | 1 - 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 185ef8cbef8..c009b9cc5fb 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -751,7 +751,7 @@ typedef struct ScrewModifierData { // #define MOD_SCREW_OBJECT_ANGLE (1<<4) typedef struct OceanModifierData { - ModifierData modifier; + ModifierData modifier; struct Ocean *ocean; struct OceanCache *oceancache; @@ -773,25 +773,27 @@ typedef struct OceanModifierData { float foam_coverage; float time; - int seed; - int flag; - int output; - - int refresh; - int bakestart; int bakeend; char cachepath[240]; // FILE_MAX - int cached; - - int geometry_mode; + char cached; + char geometry_mode; + + char flag; + char refresh; + + short repeat_x; + short repeat_y; + + int seed; + float size; - int repeat_x; - int repeat_y; float foam_fade; - + + int pad; + } OceanModifierData; #define MOD_OCEAN_GEOM_GENERATE 0 diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index e0ccb1f908e..a61cc856662 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -178,7 +178,6 @@ static void copyData(ModifierData *md, ModifierData *target) tomd->seed = omd->seed; tomd->flag = omd->flag; - tomd->output = omd->output; tomd->refresh = 0; From f72c668c073ebb9f6c46511b4fcc6f61f6ae74ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 04:11:01 +0000 Subject: [PATCH 068/203] add back feature from 2.4x - Shift+Del to delete objects from all scenes. --- source/blender/editors/object/object_add.c | 21 ++++++++++++++++++++- source/blender/editors/object/object_ops.c | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9b539871cbc..a6d3365ad8a 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -885,10 +885,11 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) MEM_freeN(base); } -static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) +static int object_delete_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + const short use_global= RNA_boolean_get(op->ptr, "global"); /* int islamp= 0; */ /* UNUSED */ if(CTX_data_edit_object(C)) @@ -903,6 +904,22 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); + + if (use_global) { + Scene *scene_iter; + Base *base_other; + + for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) { + if (scene_iter != scene && !(scene_iter->id.lib)) { + base_other= object_in_scene(base->object, scene_iter); + if (base_other) { + ED_base_object_free_and_unlink(bmain, scene_iter, base_other); + } + } + } + } + /* end global */ + } CTX_DATA_END; @@ -929,6 +946,8 @@ void OBJECT_OT_delete(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "global", 0, "Delete Globally", "Remove object from all scenes"); } /**************************** Copy Utilities ******************************/ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 56c75331d48..b7fe2d70b37 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -338,7 +338,10 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OBJECT_OT_move_to_layer", MKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "global", TRUE); WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "global", TRUE); + WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); From 4371db4b3340a193f99c35941243cc206ea7de95 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 06:33:33 +0000 Subject: [PATCH 069/203] Fix #29165: Arrow keys not working correct in Compositing Node Editor Bug is caused because of how ui_handle_menu_event works -- it makes quite tricky check in which direction movement happens depending on button type. Checked usages for uiItemV and found that it's used in node_editor only, so changed type of button used there, so ui_handle_menu_event works would detect right direction of movement. --- source/blender/editors/interface/interface_layout.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a6f93101fdc..1560c32250f 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1492,11 +1492,11 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) w= ui_text_icon_width(layout, name, icon, 0); if(icon && name[0]) - uiDefIconTextButF(block, BUTM, 0, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefIconTextButF(block, BUT, 0, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); else if(icon) - uiDefIconButF(block, BUTM, 0, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefIconButF(block, BUT, 0, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); else - uiDefButF(block, BUTM, 0, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefButF(block, BUT, 0, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); } /* separator item */ From e8906f5254cdedb0dcbfab31a800ba1f9ed860f5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 06:37:47 +0000 Subject: [PATCH 070/203] Fix #29253: 3D Manipulator: "Active Element" not supported for curves This funcitonality simply wasn't implemented for curves yet, implemented it now. --- source/blender/editors/curve/editcurve.c | 55 +++++++++--- source/blender/editors/include/ED_curve.h | 2 + .../editors/transform/transform_generics.c | 26 ++++-- .../editors/transform/transform_manipulator.c | 89 ++++++++++--------- 4 files changed, 112 insertions(+), 60 deletions(-) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 1f6673137a1..1415b8965fe 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5468,6 +5468,24 @@ static int point_on_nurb(Nurb *nu, void *point) } } +static Nurb *get_lastsel_nurb(Curve *cu) +{ + ListBase *nubase= curve_editnurbs(cu); + Nurb *nu= nubase->first; + + if(!cu->lastsel) + return NULL; + + while (nu) { + if (point_on_nurb(nu, cu->lastsel)) + return nu; + + nu= nu->next; + } + + return NULL; +} + static void select_nth_bezt(Nurb *nu, BezTriple *bezt, int nth) { int a, start; @@ -5517,21 +5535,11 @@ static void select_nth_bp(Nurb *nu, BPoint *bp, int nth) int CU_select_nth(Object *obedit, int nth) { Curve *cu= (Curve*)obedit->data; - ListBase *nubase= curve_editnurbs(cu); Nurb *nu; - int ok=0; - /* Search nurb to which selected point belongs to */ - nu= nubase->first; - while (nu) { - if (point_on_nurb(nu, cu->lastsel)) { - ok= 1; - break; - } - nu= nu->next; - } - - if (!ok) return 0; + nu= get_lastsel_nurb(cu); + if (!nu) + return 0; if (nu->bezt) { select_nth_bezt(nu, cu->lastsel, nth); @@ -7070,3 +7078,24 @@ void ED_curve_bpcpy(EditNurb *editnurb, BPoint *dst, BPoint *src, int count) memcpy(dst, src, count*sizeof(BPoint)); keyIndex_updateBP(editnurb, src, dst, count); } + +int ED_curve_actSelection(Curve *cu, float center[3]) +{ + Nurb *nu= get_lastsel_nurb(cu); + + if(!nu) + return 0; + + if(nu->bezt) { + BezTriple *bezt= cu->lastsel; + + copy_v3_v3(center, bezt->vec[1]); + } + else { + BPoint *bp= cu->lastsel; + + copy_v3_v3(center, bp->vec); + } + + return 1; +} diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 1f9b034b2e5..8f97d1c8602 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -89,6 +89,8 @@ void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint int ED_curve_updateAnimPaths(struct Object *obedit); +int ED_curve_actSelection(struct Curve *cu, float center[3]); + /* debug only */ void printknots(struct Object *obedit); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 3a8c2e80351..72f10a532d7 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1548,14 +1548,26 @@ void calculateCenter(TransInfo *t) /* EDIT MODE ACTIVE EDITMODE ELEMENT */ - if (t->obedit && t->obedit->type == OB_MESH) { - EditSelection ese; - EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data); + if (t->obedit) { + if(t->obedit->type == OB_MESH) { + EditSelection ese; + EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data); - if (EM_get_actSelection(em, &ese)) { - EM_editselection_center(t->center, &ese); - calculateCenter2D(t); - break; + if (EM_get_actSelection(em, &ese)) { + EM_editselection_center(t->center, &ese); + calculateCenter2D(t); + break; + } + } + else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { + float center[3]; + Curve *cu= (Curve *)t->obedit->data; + + if (ED_curve_actSelection(cu, center)) { + copy_v3_v3(t->center, center); + calculateCenter2D(t); + break; + } } } /* END EDIT MODE ACTIVE ELEMENT */ diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 5b275a572cb..63495d54cf1 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -71,6 +71,7 @@ #include "WM_types.h" #include "ED_armature.h" +#include "ED_curve.h" #include "ED_mesh.h" #include "ED_particle.h" #include "ED_view3d.h" @@ -390,56 +391,64 @@ int calc_manipulator_stats(const bContext *C) } else if ELEM(obedit->type, OB_CURVE, OB_SURF) { Curve *cu= obedit->data; - Nurb *nu; - BezTriple *bezt; - BPoint *bp; - ListBase *nurbs= curve_editnurbs(cu); + float center[3]; - nu= nurbs->first; - while(nu) { - if(nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; - while(a--) { - /* exceptions - * if handles are hidden then only check the center points. - * If the center knot is selected then only use this as the center point. - */ - if (cu->drawflag & CU_HIDE_HANDLES) { - if (bezt->f2 & SELECT) { + if (v3d->around==V3D_ACTIVE && ED_curve_actSelection(cu, center)) { + calc_tw_center(scene, center); + totsel++; + } + else { + Nurb *nu; + BezTriple *bezt; + BPoint *bp; + ListBase *nurbs= curve_editnurbs(cu); + + nu= nurbs->first; + while(nu) { + if(nu->type == CU_BEZIER) { + bezt= nu->bezt; + a= nu->pntsu; + while(a--) { + /* exceptions + * if handles are hidden then only check the center points. + * If the center knot is selected then only use this as the center point. + */ + if (cu->drawflag & CU_HIDE_HANDLES) { + if (bezt->f2 & SELECT) { + calc_tw_center(scene, bezt->vec[1]); + totsel++; + } + } + else if (bezt->f2 & SELECT) { calc_tw_center(scene, bezt->vec[1]); totsel++; } + else { + if(bezt->f1) { + calc_tw_center(scene, bezt->vec[0]); + totsel++; + } + if(bezt->f3) { + calc_tw_center(scene, bezt->vec[2]); + totsel++; + } + } + bezt++; } - else if (bezt->f2 & SELECT) { - calc_tw_center(scene, bezt->vec[1]); - totsel++; - } - else { - if(bezt->f1) { - calc_tw_center(scene, bezt->vec[0]); - totsel++; - } - if(bezt->f3) { - calc_tw_center(scene, bezt->vec[2]); + } + else { + bp= nu->bp; + a= nu->pntsu*nu->pntsv; + while(a--) { + if(bp->f1 & SELECT) { + calc_tw_center(scene, bp->vec); totsel++; } + bp++; } - bezt++; } + nu= nu->next; } - else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; - while(a--) { - if(bp->f1 & SELECT) { - calc_tw_center(scene, bp->vec); - totsel++; - } - bp++; - } - } - nu= nu->next; } } else if(obedit->type==OB_MBALL) { From 8a0da0b59e0277b48bf4dbb00c6a01d026e6d0bb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 07:00:01 +0000 Subject: [PATCH 071/203] Fix #29202: Crash - VSE Cross strip probably leads to this Crash was caused by several conditions: - Frame which failed to decode tried to be converted to RGB colorspace and some filters like deinterlacing used to be applied as well (it's avscale stuff sws_scale where crash happened). - In some cases it happened reading of freed memory when calling sws_scale function. Looks like it happened because of freeing packet on which decoding of frame finished and reading next packet. Solved this two issues by making YUV->RGB conversion as soon as frame was decoded in ffmpeg_decode_video_frame (such postprocessing used to happen in callee of this function ffmpeg_fetchibuf), so now sws_scale would be called before freeing packet on which decoding of frame finished and it wouldn't be called in cases when decoding of frame failed. If decoding of frame failed, it'll be black ibuf returned to the sequencer. --- source/blender/imbuf/intern/anim_movie.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index fb6c85c2408..3c32332cd8d 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -747,6 +747,8 @@ static int ffmpeg_decode_video_frame(struct anim * anim) anim->next_pts = av_get_pts_from_frame(anim->pFormatCtx, anim->pFrame); + + ffmpeg_postprocess(anim); } av_free_packet(&anim->next_packet); @@ -797,6 +799,8 @@ static int ffmpeg_decode_video_frame(struct anim * anim) == AV_NOPTS_VALUE) ? -1 : (long long int)anim->pFrame->pkt_pts, (long long int)anim->next_pts); + + ffmpeg_postprocess(anim); } } av_free_packet(&anim->next_packet); @@ -808,6 +812,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim) AV_LOG_ERROR, " DECODE READ FAILED: av_read_frame() " "returned error: %d\n", rval); } + return (rval >= 0); } @@ -947,6 +952,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, } IMB_freeImBuf(anim->last_frame); + anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); if (anim->next_pts <= pts_to_search && anim->next_undecoded_pts > pts_to_search) { @@ -1050,10 +1056,6 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, ffmpeg_decode_video_frame(anim); } - anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); - - ffmpeg_postprocess(anim); - anim->last_pts = anim->next_pts; ffmpeg_decode_video_frame(anim); From d6c1009195df15f6eb920f36610c0d679bce415e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 07:09:41 +0000 Subject: [PATCH 072/203] bytestring support for py/rna - this is so py can access data which isn't meant to be accessed as unicode text. --- .../editors/interface/interface_handlers.c | 2 +- source/blender/makesrna/RNA_types.h | 4 +- source/blender/makesrna/intern/makesrna.c | 1 + source/blender/python/intern/bpy_props.c | 1 + source/blender/python/intern/bpy_rna.c | 142 ++++++++++++------ 5 files changed, 104 insertions(+), 46 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ee1f9617813..688e8f95ac7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -271,7 +271,7 @@ int ui_is_but_utf8(uiBut *but) { if (but->rnaprop) { const int subtype= RNA_property_subtype(but->rnaprop); - return !(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)); + return !(ELEM4(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING)); } else { return !(but->flag & UI_BUT_NO_UTF8); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 1655665efe3..e768594fe73 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -108,7 +108,9 @@ typedef enum PropertySubType { PROP_FILEPATH = 1, PROP_DIRPATH = 2, PROP_FILENAME = 3, - PROP_TRANSLATE = 4, /* a string which should be translated */ + PROP_BYTESTRING = 4, /* a string which should be represented as bytes + * in python, still NULL terminated though. */ + PROP_TRANSLATE = 5, /* a string which should be translated */ /* numbers */ PROP_UNSIGNED = 13, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 1eaeaf8278f..a3054b88960 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1816,6 +1816,7 @@ static const char *rna_property_subtypename(PropertySubType type) case PROP_FILEPATH: return "PROP_FILEPATH"; case PROP_FILENAME: return "PROP_FILENAME"; case PROP_DIRPATH: return "PROP_DIRPATH"; + case PROP_BYTESTRING: return "PROP_BYTESTRING"; case PROP_TRANSLATE: return "PROP_TRANSLATE"; case PROP_UNSIGNED: return "PROP_UNSIGNED"; case PROP_PERCENTAGE: return "PROP_PERCENTAGE"; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 2b71cdd4ffc..950aa9458d5 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -74,6 +74,7 @@ static EnumPropertyItem property_subtype_string_items[]= { {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, {PROP_FILENAME, "FILENAME", 0, "Filename", ""}, + {PROP_BYTESTRING, "BYTE_STRING", 0, "Byte String", ""}, {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, {PROP_NONE, "NONE", 0, "None", ""}, diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 15a9ba44552..5ac83b8bf79 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1328,14 +1328,22 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len); #ifdef USE_STRING_COERCE /* only file paths get special treatment, they may contain non utf-8 chars */ - if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + if (subtype == PROP_BYTESTRING) { + ret= PyBytes_FromStringAndSize(buf, buf_len); + } + else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { ret= PyC_UnicodeFromByteAndSize(buf, buf_len); } else { ret= PyUnicode_FromStringAndSize(buf, buf_len); } #else // USE_STRING_COERCE - ret= PyUnicode_FromStringAndSize(buf, buf_len); + if (subtype == PROP_BYTESTRING) { + ret= PyBytes_FromStringAndSize(buf, buf_len); + } + else { + ret= PyUnicode_FromStringAndSize(buf, buf_len); + } #endif // USE_STRING_COERCE if (buf_fixed != buf) { MEM_freeN((void *)buf); @@ -1534,53 +1542,91 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } case PROP_STRING: { - const char *param; -#ifdef USE_STRING_COERCE - PyObject *value_coerce= NULL; int subtype= RNA_property_subtype(prop); - if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { - /* TODO, get size */ - param= PyC_UnicodeAsByte(value, &value_coerce); - } - else { - param= _PyUnicode_AsString(value); -#ifdef WITH_INTERNATIONAL - if (subtype == PROP_TRANSLATE) { - param= IFACE_(param); - } -#endif // WITH_INTERNATIONAL + const char *param; - } -#else // USE_STRING_COERCE - param= _PyUnicode_AsString(value); -#endif // USE_STRING_COERCE + if (subtype == PROP_BYTESTRING) { - if (param==NULL) { - if (PyUnicode_Check(value)) { - /* there was an error assigning a string type, - * rather than setting a new error, prefix the existing one - */ - PyC_Err_Format_Prefix(PyExc_TypeError, - "%.200s %.200s.%.200s error assigning string", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop)); + /* Byte String */ + + param= PyBytes_AsString(value); + + if (param==NULL) { + if (PyBytes_Check(value)) { + /* there was an error assigning a string type, + * rather than setting a new error, prefix the existing one + */ + PyC_Err_Format_Prefix(PyExc_TypeError, + "%.200s %.200s.%.200s error assigning bytes", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop)); + } + else { + PyErr_Format(PyExc_TypeError, + "%.200s %.200s.%.200s expected a bytes type, not %.200s", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + } + + return -1; } else { - PyErr_Format(PyExc_TypeError, - "%.200s %.200s.%.200s expected a string type, not %.200s", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + /* same as unicode */ + if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */ + else RNA_property_string_set(ptr, prop, param); } - - return -1; } else { - if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */ - else RNA_property_string_set(ptr, prop, param); - } + + /* Unicode String */ + #ifdef USE_STRING_COERCE - Py_XDECREF(value_coerce); + PyObject *value_coerce= NULL; + if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + /* TODO, get size */ + param= PyC_UnicodeAsByte(value, &value_coerce); + } + else { + param= _PyUnicode_AsString(value); +#ifdef WITH_INTERNATIONAL + if (subtype == PROP_TRANSLATE) { + param= IFACE_(param); + } +#endif // WITH_INTERNATIONAL + + } +#else // USE_STRING_COERCE + param= _PyUnicode_AsString(value); #endif // USE_STRING_COERCE + + if (param==NULL) { + if (PyUnicode_Check(value)) { + /* there was an error assigning a string type, + * rather than setting a new error, prefix the existing one + */ + PyC_Err_Format_Prefix(PyExc_TypeError, + "%.200s %.200s.%.200s error assigning string", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop)); + } + else { + PyErr_Format(PyExc_TypeError, + "%.200s %.200s.%.200s expected a string type, not %.200s", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + } + + return -1; + } + else { + /* same as bytes */ + if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */ + else RNA_property_string_set(ptr, prop, param); + } +#ifdef USE_STRING_COERCE + Py_XDECREF(value_coerce); +#endif // USE_STRING_COERCE + } break; } case PROP_ENUM: @@ -2751,7 +2797,7 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje if (rna_disallow_writes && rna_id_write_error(&self->ptr, key)) { return -1; } -#endif // USE_STRING_COERCE +#endif // USE_PEDANTIC_WRITE if (group==NULL) { PyErr_SetString(PyExc_TypeError, "bpy_struct[key]= val: id properties not supported for this type"); @@ -3440,7 +3486,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { return -1; } -#endif // USE_STRING_COERCE +#endif // USE_PEDANTIC_WRITE if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string"); @@ -3600,7 +3646,7 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { return -1; } -#endif // USE_STRING_COERCE +#endif // USE_PEDANTIC_WRITE if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_prop: __setattr__ must be a string"); @@ -4450,14 +4496,22 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat data_ch= *(char **)data; #ifdef USE_STRING_COERCE - if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + if (subtype == PROP_BYTESTRING) { + ret= PyBytes_FromString(data_ch); + } + else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { ret= PyC_UnicodeFromByte(data_ch); } else { ret= PyUnicode_FromString(data_ch); } #else - ret= PyUnicode_FromString(data_ch); + if (subtype == PROP_BYTESTRING) { + ret= PyBytes_FromString(buf); + } + else { + ret= PyUnicode_FromString(data_ch); + } #endif #ifdef USE_STRING_COERCE From a3bbae989265fea3bf64815f73b454145897f138 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 07:28:18 +0000 Subject: [PATCH 073/203] Workaround for half-transparent windows when running blender-softwaregl and compiz effects are enabled. Thanks to Nicholas Bishop for pointing in possible solution of this issue. --- release/bin/blender-softwaregl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/bin/blender-softwaregl b/release/bin/blender-softwaregl index 3cd96d2ff34..970a7870760 100755 --- a/release/bin/blender-softwaregl +++ b/release/bin/blender-softwaregl @@ -15,7 +15,10 @@ if [ -n "$LD_LIBRARY_PATH_64" ]; then LD_LIBRARY_PATH_64=${BF_DIST_BIN}/lib:${LD_LIBRARY_PATH_64} fi -export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD +# Workaround for half-transparent windows when compiz is enabled +XLIB_SKIP_ARGB_VISUALS=1 + +export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD XLIB_SKIP_ARGB_VISUALS "$BF_DIST_BIN/$BF_PROGRAM" ${1+"$@"} exitcode=$? From ab3295db33ad0152986818cc36f171c52de66482 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 07:30:26 +0000 Subject: [PATCH 074/203] fix for crash in blenderplayer when the engine isnt fount. --- source/blender/blenkernel/intern/scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 14dfe015894..8b8c974cdc8 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1163,6 +1163,6 @@ Base *_setlooper_base_step(Scene **sce_iter, Base *base) int scene_use_new_shading_nodes(Scene *scene) { RenderEngineType *type= RE_engines_find(scene->r.engine); - return (type->flag & RE_USE_SHADING_NODES); + return (type && type->flag & RE_USE_SHADING_NODES); } From 697726468e52ce18deb4e75b92bbeaeb3af09518 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 07:35:28 +0000 Subject: [PATCH 075/203] fix for own error, BLI_replace_extension would strip the filename if there wasn't already an extension. --- source/blender/blenlib/intern/path_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 7c7d51e5907..08d9dfaeb9e 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1414,6 +1414,10 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) } } + if (path[a] != '.') { + a= path_len; + } + if(a + ext_len >= maxlen) return 0; From 5cf345f860b329652160a583feadf6decfa8fdab Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 08:43:23 +0000 Subject: [PATCH 076/203] Request from nico_ga: expose WITH_BF_STATIC* variables to linux-config so builders can easily find interesting for them flag. --- build_files/scons/config/linux-config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index 3461f4a9af3..a141f12ce60 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -197,7 +197,8 @@ BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib' BF_JEMALLOC_LIB = 'jemalloc' BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a' -WITH_BF_OIIO = True +WITH_BF_OIIO = True +WITH_BF_OIIO = False BF_OIIO = LIBDIR + '/oiio' if not os.path.exists(LCGDIR + '/oiio'): WITH_BF_OIIO = False @@ -207,6 +208,7 @@ BF_OIIO_LIB = 'OpenImageIO' BF_OIIO_LIBPATH = BF_OIIO + '/lib' WITH_BF_BOOST = True +WITH_BF_STATICBOOST = False BF_BOOST = LIBDIR + '/boost' if not os.path.exists(LCGDIR + '/boost'): WITH_BF_BOOST = False @@ -225,6 +227,7 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread'] #SpaceNavigator and friends WITH_BF_3DMOUSE = True +WITH_BF_STATIC3DMOUSE = False BF_3DMOUSE = '/usr' BF_3DMOUSE_INC = '${BF_3DMOUSE}/include' BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib' From ae046bc0eba28acb4101215e7dae411f99214ea1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 08:43:28 +0000 Subject: [PATCH 077/203] Patch from nico_ga: libmv can be compiled with icc now --- extern/libmv/third_party/glog/src/config_linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/libmv/third_party/glog/src/config_linux.h b/extern/libmv/third_party/glog/src/config_linux.h index df6956c9ecf..ffd4e778de6 100644 --- a/extern/libmv/third_party/glog/src/config_linux.h +++ b/extern/libmv/third_party/glog/src/config_linux.h @@ -131,7 +131,7 @@ #define PACKAGE_VERSION "0.3.1" /* How to access the PC from a struct ucontext */ -#if defined(_M_X64) || defined(__amd64__) +#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] #else #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_EIP] From 2ab17326135e666dd31bb0695ebc2ef426615fae Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 09:12:10 +0000 Subject: [PATCH 078/203] support for non-null terminated byte strings in id properties (as a subtype of IDP_STRING types) --- source/blender/blenkernel/BKE_idprop.h | 6 ++- source/blender/blenkernel/intern/idprop.c | 55 ++++++++++++++------- source/blender/makesdna/DNA_ID.h | 7 +++ source/blender/makesrna/intern/rna_access.c | 30 ++++++++--- source/blender/python/generic/IDProp.c | 32 ++++++++++-- 5 files changed, 101 insertions(+), 29 deletions(-) diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 10c02f54b2e..ef760277f56 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -40,7 +40,11 @@ typedef union IDPropertyTemplate { int i; float f; double d; - char *str; + struct { + char *str; + short len; + char subtype; + } string; struct ID *id; struct { short type; diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index ac4b936cb41..07057e4ee32 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -349,17 +349,20 @@ static IDProperty *IDP_CopyString(IDProperty *prop) void IDP_AssignString(IDProperty *prop, const char *st, int maxlen) { - int stlen; - - stlen = strlen(st); + int stlen = strlen(st); if(maxlen > 0 && maxlen < stlen) stlen= maxlen; - stlen++; /* make room for null byte */ - - IDP_ResizeArray(prop, stlen); - BLI_strncpy(prop->data.pointer, st, stlen); + if (prop->subtype == IDP_STRING_SUB_BYTE) { + IDP_ResizeArray(prop, stlen); + memcpy(prop->data.pointer, st, stlen); + } + else { + stlen++; /* make room for null byte */ + IDP_ResizeArray(prop, stlen); + BLI_strncpy(prop->data.pointer, st, stlen); + } } void IDP_ConcatStringC(IDProperty *prop, const char *st) @@ -703,18 +706,36 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) } case IDP_STRING: { - char *st = val.str; + const char *st = val.string.str; prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); - if (st == NULL) { - prop->data.pointer = MEM_callocN(DEFAULT_ALLOC_FOR_NULL_STRINGS, "id property string 1"); - prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS; - prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/ - } else { - int stlen = strlen(st) + 1; - prop->data.pointer = MEM_mallocN(stlen, "id property string 2"); - prop->len = prop->totallen = stlen; - memcpy(prop->data.pointer, st, stlen); + if (val.string.subtype == IDP_STRING_SUB_BYTE) { + /* note, intentionally not null terminated */ + if (st == NULL) { + prop->data.pointer = MEM_callocN(DEFAULT_ALLOC_FOR_NULL_STRINGS, "id property string 1"); + prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS; + prop->len = 0; + } + else { + prop->data.pointer = MEM_mallocN(val.string.len, "id property string 2"); + prop->len = prop->totallen = val.string.len; + memcpy(prop->data.pointer, st, val.string.len); + } + prop->subtype= IDP_STRING_SUB_BYTE; + } + else { + if (st == NULL) { + prop->data.pointer = MEM_callocN(DEFAULT_ALLOC_FOR_NULL_STRINGS, "id property string 1"); + prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS; + prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/ + } + else { + int stlen = strlen(st) + 1; + prop->data.pointer = MEM_mallocN(stlen, "id property string 3"); + prop->len = prop->totallen = stlen; + memcpy(prop->data.pointer, st, stlen); + } + prop->subtype= IDP_STRING_SUB_UTF8; } break; } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index c135254b11b..97ea7592d04 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -80,6 +80,13 @@ typedef struct IDProperty { #define IDP_IDPARRAY 9 #define IDP_NUMTYPES 10 +/*->subtype */ + +/* IDP_STRING */ +#define IDP_STRING_SUB_UTF8 0 /* default */ +#define IDP_STRING_SUB_BYTE 1 /* arbitrary byte array, _not_ null terminated */ + + /* add any future new id property types here.*/ /* watch it: Sequence has identical beginning. */ diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6f9c7a8f19b..47a7420cb7f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2271,12 +2271,23 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) BLI_assert(RNA_property_type(prop) == PROP_STRING); - if((idprop=rna_idproperty_check(&prop, ptr))) - strcpy(value, IDP_String(idprop)); - else if(sprop->get) + if((idprop=rna_idproperty_check(&prop, ptr))) { + /* editing bytes is not 100% supported + * since they can contain NIL chars */ + if (idprop->subtype == IDP_STRING_SUB_BYTE) { + memcpy(value, IDP_String(idprop), idprop->len + 1); + value[idprop->len]= '\0'; + } + else { + strcpy(value, IDP_String(idprop)); + } + } + else if(sprop->get) { sprop->get(ptr, value); - else + } + else { strcpy(value, sprop->defaultvalue); + } } char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, @@ -2320,8 +2331,14 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) BLI_assert(RNA_property_type(prop) == PROP_STRING); - if((idprop=rna_idproperty_check(&prop, ptr))) - return strlen(IDP_String(idprop)); + if((idprop=rna_idproperty_check(&prop, ptr))) { + if (idprop->subtype == IDP_STRING_SUB_BYTE) { + return idprop->len; + } + else { + return strlen(IDP_String(idprop)); + } + } else if(sprop->length) return sprop->length(ptr); else @@ -2336,6 +2353,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val BLI_assert(RNA_property_type(prop) == PROP_STRING); if((idprop=rna_idproperty_check(&prop, ptr))) + /* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */ IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1); else if(sprop->set) sprop->set(ptr, value); /* set function needs to clamp its self */ diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 6d869a7eb1f..d0759a69d8f 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -64,11 +64,18 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) { switch ( prop->type ) { case IDP_STRING: + + if (prop->subtype == IDP_STRING_SUB_BYTE) { + return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len); + } + else { #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); #else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); #endif + } + case IDP_INT: return PyLong_FromLong( (long)prop->data.val ); case IDP_FLOAT: @@ -332,7 +339,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty else if (PyUnicode_Check(ob)) { #ifdef USE_STRING_COERCE PyObject *value_coerce= NULL; - val.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce); + val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce); + val.string.subtype = IDP_STRING_SUB_UTF8; prop = IDP_New(IDP_STRING, val, name); Py_XDECREF(value_coerce); #else @@ -340,6 +348,15 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty prop = IDP_New(IDP_STRING, val, name); #endif } + else if (PyBytes_Check(ob)) { + val.string.str= PyBytes_AS_STRING(ob); + val.string.len= PyBytes_GET_SIZE(ob); + val.string.subtype= IDP_STRING_SUB_BYTE; + + prop = IDP_New(IDP_STRING, val, name); + //prop = IDP_NewString(PyBytes_AS_STRING(ob), name, PyBytes_GET_SIZE(ob)); + //prop->subtype= IDP_STRING_SUB_BYTE; + } else if (PySequence_Check(ob)) { PyObject *item; int i; @@ -493,11 +510,16 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) { switch (prop->type) { case IDP_STRING: + if (prop->subtype == IDP_STRING_SUB_BYTE) { + return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len); + } + else { #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); #else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); #endif + } break; case IDP_FLOAT: return PyFloat_FromDouble(*((float*)&prop->data.val)); From df6aa48eb98da2637982e1a3d086a2e225815e13 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 09:21:22 +0000 Subject: [PATCH 079/203] Fixed typo in previous commit --- build_files/scons/config/linux-config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index a141f12ce60..af5f73fb87c 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -198,7 +198,7 @@ BF_JEMALLOC_LIB = 'jemalloc' BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a' WITH_BF_OIIO = True -WITH_BF_OIIO = False +WITH_BF_STATICOIIO = False BF_OIIO = LIBDIR + '/oiio' if not os.path.exists(LCGDIR + '/oiio'): WITH_BF_OIIO = False From 8623935aa838a168f64b54f4fefe472444db72fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 09:22:52 +0000 Subject: [PATCH 080/203] pass a pointer to IDP_New's IDPropertyTemplate rather then a copy. --- source/blender/blenkernel/BKE_idprop.h | 2 +- source/blender/blenkernel/intern/idprop.c | 31 ++++++++++--------- source/blender/editors/interface/interface.c | 2 +- .../editors/interface/interface_layout.c | 4 +-- .../editors/sculpt_paint/paint_image.c | 2 +- source/blender/makesrna/intern/rna_access.c | 20 ++++++------ source/blender/makesrna/intern/rna_armature.c | 4 +-- source/blender/makesrna/intern/rna_pose.c | 2 +- source/blender/makesrna/intern/rna_wm.c | 2 +- source/blender/python/generic/IDProp.c | 14 ++++----- .../windowmanager/intern/wm_event_system.c | 2 +- .../windowmanager/intern/wm_operators.c | 2 +- 12 files changed, 44 insertions(+), 43 deletions(-) diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index ef760277f56..fbe5bf2ef44 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -187,7 +187,7 @@ Note that you MUST either attach the id property to an id property group with IDP_AddToGroup or MEM_freeN the property, doing anything else might result in a memory leak. */ -struct IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name); +struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name); /** \note this will free all child properties of list arrays and groups! Also, note that this does NOT unlink anything! Plus it doesn't free diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 07057e4ee32..a07af5161db 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -193,7 +193,7 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr) for(a=prop->len; adata.val = val.i; + prop->data.val = val->i; break; case IDP_FLOAT: prop = MEM_callocN(sizeof(IDProperty), "IDProperty float"); - *(float*)&prop->data.val = val.f; + *(float*)&prop->data.val = val->f; break; case IDP_DOUBLE: prop = MEM_callocN(sizeof(IDProperty), "IDProperty float"); - *(double*)&prop->data.val = val.d; + *(double*)&prop->data.val = val->d; break; case IDP_ARRAY: { /*for now, we only support float and int and double arrays*/ - if (val.array.type == IDP_FLOAT || val.array.type == IDP_INT || val.array.type == IDP_DOUBLE || val.array.type == IDP_GROUP) { + if (val->array.type == IDP_FLOAT || val->array.type == IDP_INT || val->array.type == IDP_DOUBLE || val->array.type == IDP_GROUP) { prop = MEM_callocN(sizeof(IDProperty), "IDProperty array"); - prop->subtype = val.array.type; - if (val.array.len) - prop->data.pointer = MEM_callocN(idp_size_table[val.array.type]*val.array.len, "id property array"); - prop->len = prop->totallen = val.array.len; + prop->subtype = val->array.type; + if (val->array.len) + prop->data.pointer = MEM_callocN(idp_size_table[val->array.type]*val->array.len, "id property array"); + prop->len = prop->totallen = val->array.len; break; } else { return NULL; @@ -706,10 +707,10 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) } case IDP_STRING: { - const char *st = val.string.str; + const char *st = val->string.str; prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); - if (val.string.subtype == IDP_STRING_SUB_BYTE) { + if (val->string.subtype == IDP_STRING_SUB_BYTE) { /* note, intentionally not null terminated */ if (st == NULL) { prop->data.pointer = MEM_callocN(DEFAULT_ALLOC_FOR_NULL_STRINGS, "id property string 1"); @@ -717,9 +718,9 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) prop->len = 0; } else { - prop->data.pointer = MEM_mallocN(val.string.len, "id property string 2"); - prop->len = prop->totallen = val.string.len; - memcpy(prop->data.pointer, st, val.string.len); + prop->data.pointer = MEM_mallocN(val->string.len, "id property string 2"); + prop->len = prop->totallen = val->string.len; + memcpy(prop->data.pointer, st, val->string.len); } prop->subtype= IDP_STRING_SUB_BYTE; } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index be8bee7452d..b34b56f31ed 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -831,7 +831,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) if (prop_menu == NULL) { /* annoying, create a property */ IDPropertyTemplate val = {0}; - prop_menu= IDP_New(IDP_GROUP, val, __func__); /* dummy, name is unimportant */ + prop_menu= IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant */ IDP_AddToGroup(prop_menu, (prop_menu_name= IDP_NewString("", "name", sizeof(mt->idname)))); } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 1560c32250f..29d37be1dee 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -677,7 +677,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i } else { IDPropertyTemplate val = {0}; - opptr->data= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); + opptr->data= IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); } return *opptr; @@ -2747,7 +2747,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in { if(!op->properties) { IDPropertyTemplate val = {0}; - op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); + op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); } if(flag & UI_LAYOUT_OP_SHOW_TITLE) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e283927b76f..ff2a1adbdf5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5669,7 +5669,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) val.array.len = PROJ_VIEW_DATA_SIZE; val.array.type = IDP_FLOAT; - view_data = IDP_New(IDP_ARRAY, val, PROJ_VIEW_DATA_ID); + view_data = IDP_New(IDP_ARRAY, &val, PROJ_VIEW_DATA_ID); array= (float *)IDP_Array(view_data); memcpy(array, rv3d->winmat, sizeof(rv3d->winmat)); array += sizeof(rv3d->winmat)/sizeof(float); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 47a7420cb7f..2b31f7184b6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1617,7 +1617,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); } } @@ -1696,7 +1696,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, prop->identifier); + idprop= IDP_New(IDP_ARRAY, &val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -1814,7 +1814,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); } } @@ -1930,7 +1930,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, prop->identifier); + idprop= IDP_New(IDP_ARRAY, &val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -2050,7 +2050,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier)); } } @@ -2184,7 +2184,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, prop->identifier); + idprop= IDP_New(IDP_ARRAY, &val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len); } @@ -2439,7 +2439,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); } } @@ -2535,7 +2535,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier)); } else printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); @@ -2658,7 +2658,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA IDPropertyTemplate val = {0}; IDProperty *item; - item= IDP_New(IDP_GROUP, val, ""); + item= IDP_New(IDP_GROUP, &val, ""); IDP_AppendArray(idprop, item); // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory MEM_freeN(item); @@ -2672,7 +2672,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA idprop= IDP_NewIDPArray(prop->identifier); IDP_AddToGroup(group, idprop); - item= IDP_New(IDP_GROUP, val, ""); + item= IDP_New(IDP_GROUP, &val, ""); IDP_AppendArray(idprop, item); // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory MEM_freeN(item); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 1ea1a4e3e7b..6785f1f4caf 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -169,7 +169,7 @@ static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create) if(create && !bone->prop) { IDPropertyTemplate val = {0}; - bone->prop= IDP_New(IDP_GROUP, val, "RNA_Bone ID properties"); + bone->prop= IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties"); } return bone->prop; @@ -181,7 +181,7 @@ static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, int create) if(create && !ebone->prop) { IDPropertyTemplate val = {0}; - ebone->prop= IDP_New(IDP_GROUP, val, "RNA_EditBone ID properties"); + ebone->prop= IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties"); } return ebone->prop; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index d224bd0d4e5..6290c01f992 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -157,7 +157,7 @@ static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create) if(create && !pchan->prop) { IDPropertyTemplate val = {0}; - pchan->prop= IDP_New(IDP_GROUP, val, "RNA_PoseBone group"); + pchan->prop= IDP_New(IDP_GROUP, &val, "RNA_PoseBone group"); } return pchan->prop; diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 77ae7095454..7e55c832f3f 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -421,7 +421,7 @@ static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, int create) { if(create && !ptr->data) { IDPropertyTemplate val = {0}; - ptr->data= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group"); + ptr->data= IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group"); } return ptr->data; diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index d0759a69d8f..8da80bd99bd 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -330,18 +330,18 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty if (PyFloat_Check(ob)) { val.d = PyFloat_AsDouble(ob); - prop = IDP_New(IDP_DOUBLE, val, name); + prop = IDP_New(IDP_DOUBLE, &val, name); } else if (PyLong_Check(ob)) { val.i = (int) PyLong_AsSsize_t(ob); - prop = IDP_New(IDP_INT, val, name); + prop = IDP_New(IDP_INT, &val, name); } else if (PyUnicode_Check(ob)) { #ifdef USE_STRING_COERCE PyObject *value_coerce= NULL; val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce); val.string.subtype = IDP_STRING_SUB_UTF8; - prop = IDP_New(IDP_STRING, val, name); + prop = IDP_New(IDP_STRING, &val, name); Py_XDECREF(value_coerce); #else val.str = _PyUnicode_AsString(ob); @@ -353,7 +353,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty val.string.len= PyBytes_GET_SIZE(ob); val.string.subtype= IDP_STRING_SUB_BYTE; - prop = IDP_New(IDP_STRING, val, name); + prop = IDP_New(IDP_STRING, &val, name); //prop = IDP_NewString(PyBytes_AS_STRING(ob), name, PyBytes_GET_SIZE(ob)); //prop->subtype= IDP_STRING_SUB_BYTE; } @@ -372,7 +372,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty switch(val.array.type) { case IDP_DOUBLE: - prop = IDP_New(IDP_ARRAY, val, name); + prop = IDP_New(IDP_ARRAY, &val, name); for (i=0; iproperties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); + op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); } RNA_pointer_create(&wm->id, ot->srna, op->properties, op->ptr); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7fb6ba6e26b..0c538865501 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -597,7 +597,7 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con { if(*properties==NULL) { IDPropertyTemplate val = {0}; - *properties= IDP_New(IDP_GROUP, val, "wmOpItemProp"); + *properties= IDP_New(IDP_GROUP, &val, "wmOpItemProp"); } if(*ptr==NULL) { From d4d80ee0a1e0e720c712ec58e30a63f7f4c005ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 09:28:15 +0000 Subject: [PATCH 081/203] rename IDProp.c/h to idprop_py_api, since it was same name as BKE idprop.c with case changed. --- source/blender/python/generic/CMakeLists.txt | 4 ++-- .../blender/python/generic/{IDProp.c => idprop_py_api.c} | 2 +- .../blender/python/generic/{IDProp.h => idprop_py_api.h} | 8 ++++---- source/blender/python/intern/bpy.c | 2 +- source/blender/python/intern/bpy_rna.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename source/blender/python/generic/{IDProp.c => idprop_py_api.c} (99%) rename source/blender/python/generic/{IDProp.h => idprop_py_api.h} (94%) diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 847a0d19a7f..bd9731a277a 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -33,17 +33,17 @@ set(INC_SYS ) set(SRC - IDProp.c bgl.c blf_py_api.c bpy_internal_import.c + idprop_py_api.c noise_py_api.c py_capi_utils.c - IDProp.h bgl.h blf_py_api.h bpy_internal_import.h + idprop_py_api.h noise_py_api.h py_capi_utils.h ) diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/idprop_py_api.c similarity index 99% rename from source/blender/python/generic/IDProp.c rename to source/blender/python/generic/idprop_py_api.c index 8da80bd99bd..30d70a39424 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -28,7 +28,7 @@ #include -#include "IDProp.h" +#include "idprop_py_api.h" #include "MEM_guardedalloc.h" #include "BLI_string.h" diff --git a/source/blender/python/generic/IDProp.h b/source/blender/python/generic/idprop_py_api.h similarity index 94% rename from source/blender/python/generic/IDProp.h rename to source/blender/python/generic/idprop_py_api.h index 36cb4c76a5c..61aad5ed3b9 100644 --- a/source/blender/python/generic/IDProp.h +++ b/source/blender/python/generic/idprop_py_api.h @@ -20,13 +20,13 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/python/generic/IDProp.h +/** \file blender/python/generic/idprop_py_api.h * \ingroup pygen */ -#ifndef IDPROP_H -#define IDPROP_H +#ifndef PY_IDPROP_API_H +#define PY_IDPROP_API_H struct ID; struct IDProperty; @@ -68,4 +68,4 @@ void IDProp_Init_Types(void); #define IDPROP_ITER_KEYS 0 #define IDPROP_ITER_ITEMS 1 -#endif /* IDPROP_H */ +#endif /* PY_IDPROP_API_H */ diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 2df907f3a12..9bb7457a1f7 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -53,7 +53,7 @@ #include "MEM_guardedalloc.h" /* external util modules */ -#include "../generic/IDProp.h" +#include "../generic/idprop_py_api.h" #include "../generic/bgl.h" #include "../generic/blf_py_api.h" #include "../mathutils/mathutils.h" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 5ac83b8bf79..6077aa26d4c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,7 +73,7 @@ #include "BKE_animsys.h" #include "BKE_fcurve.h" -#include "../generic/IDProp.h" /* for IDprop lookups */ +#include "../generic/idprop_py_api.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" #ifdef WITH_INTERNATIONAL From ba9b5f41ec1d08869d2f4227e779b6e7eae09913 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 15 Nov 2011 09:42:00 +0000 Subject: [PATCH 082/203] Minor: added the description of expected string format for the template_list's "prop_list" parameter (was missing in bpy ref...). --- source/blender/makesrna/intern/rna_ui_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 366ba1daf85..4c97a926513 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -429,7 +429,8 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "prop_list", "", 0, "", "Identifier of a string property in each data member, specifying which " - "of its properties should have a widget displayed in its row"); + "of its properties should have a widget displayed in its row " + "(format: \"propname1:propname2:propname3:...\")"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX); RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use"); From 995ca539d0a91a0b76e0700b3d76980537877028 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 15 Nov 2011 10:01:18 +0000 Subject: [PATCH 083/203] Fixed compilation error in writeffmpg.c (caused by recent IDProp changes). --- source/blender/blenkernel/intern/writeffmpeg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 036a52a1235..3af724b4e30 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1066,13 +1066,13 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index, if (!rd->ffcodecdata.properties) { rd->ffcodecdata.properties - = IDP_New(IDP_GROUP, val, "ffmpeg"); + = IDP_New(IDP_GROUP, &val, "ffmpeg"); } group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (!group) { - group = IDP_New(IDP_GROUP, val, type); + group = IDP_New(IDP_GROUP, &val, type); IDP_AddToGroup(rd->ffcodecdata.properties, group); } @@ -1102,7 +1102,9 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index, idp_type = IDP_FLOAT; break; case FF_OPT_TYPE_STRING: - val.str = (char *)" "; + val.string.str = (char *)" "; + val.string.len = 80; +/* val.str = (char *)" ";*/ idp_type = IDP_STRING; break; case FF_OPT_TYPE_CONST: @@ -1112,7 +1114,7 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index, default: return NULL; } - prop = IDP_New(idp_type, val, name); + prop = IDP_New(idp_type, &val, name); IDP_AddToGroup(group, prop); return prop; } From 4de917326b45d2678f23c60cfaa9d48dcd7aad18 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 10:19:44 +0000 Subject: [PATCH 084/203] de-duplicate some idproperty py api code, also improve some exception messages. --- source/blender/python/generic/idprop_py_api.c | 413 ++++++++++-------- source/blender/python/generic/idprop_py_api.h | 3 +- source/blender/python/intern/bpy_rna.c | 4 +- 3 files changed, 227 insertions(+), 193 deletions(-) diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 30d70a39424..73d954057c9 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -21,7 +21,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/python/generic/IDProp.c +/** \file blender/python/generic/idprop_py_api.c * \ingroup pygen */ @@ -49,6 +49,83 @@ extern PyTypeObject BPy_IDGroup_Type; /*********************** ID Property Main Wrapper Stuff ***************/ +/* ---------------------------------------------------------------------------- + * static conversion functions to avoid duplicate code, no type checking. + */ + +static PyObject *idprop_py_from_idp_string(IDProperty *prop) +{ + if (prop->subtype == IDP_STRING_SUB_BYTE) { + return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len); + } + else { +#ifdef USE_STRING_COERCE + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); +#else + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); +#endif + } +} + +static PyObject *idprop_py_from_idp_int(IDProperty *prop) +{ + return PyLong_FromLong((long)prop->data.val); +} + +static PyObject *idprop_py_from_idp_float(IDProperty *prop) +{ + return PyFloat_FromDouble((double)(*(float*)(&prop->data.val))); +} + +static PyObject *idprop_py_from_idp_double(IDProperty *prop) +{ + return PyFloat_FromDouble((*(double*)(&prop->data.val))); +} + +static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent) +{ + BPy_IDProperty *group= PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type); + group->id = id; + group->prop = prop; + group->parent = parent; /* can be NULL */ + return (PyObject*) group; +} + +static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop) +{ + BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type); + array->id = id; + array->prop = prop; + return (PyObject*) array; +} + +static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop) +{ + PyObject *seq = PyList_New(prop->len), *wrap; + IDProperty *array= IDP_IDPArray(prop); + int i; + + if (!seq) { + PyErr_Format(PyExc_RuntimeError, + "%s: IDP_IDPARRAY: PyList_New(%d) failed", + __func__, prop->len); + return NULL; + } + + for (i=0; ilen; i++) { + wrap= BPy_IDGroup_WrapData(id, array++, prop); + + if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ + return NULL; + + PyList_SET_ITEM(seq, i, wrap); + } + + return seq; +} + +/* -------------------------------------------------------------------------- */ + /* use for both array and group */ static long BPy_IDGroup_hash(BPy_IDProperty *self) { @@ -60,68 +137,26 @@ static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self) return PyUnicode_FromFormat( "", self->id->name); } -PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) +PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent) { - switch ( prop->type ) { - case IDP_STRING: - - if (prop->subtype == IDP_STRING_SUB_BYTE) { - return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len); - } - else { -#ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); -#else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); -#endif - } - - case IDP_INT: - return PyLong_FromLong( (long)prop->data.val ); - case IDP_FLOAT: - return PyFloat_FromDouble( (double)(*(float*)(&prop->data.val)) ); - case IDP_DOUBLE: - return PyFloat_FromDouble( (*(double*)(&prop->data.val)) ); - case IDP_GROUP: - /*blegh*/ - { - BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type); - group->id = id; - group->prop = prop; - return (PyObject*) group; - } - case IDP_ARRAY: - { - BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type); - array->id = id; - array->prop = prop; - return (PyObject*) array; - } - case IDP_IDPARRAY: /* this could be better a internal type */ - { - PyObject *seq = PyList_New(prop->len), *wrap; - IDProperty *array= IDP_IDPArray(prop); - int i; - - if (!seq) { - PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len); - return NULL; - } - - for (i=0; ilen; i++) { - wrap= BPy_IDGroup_WrapData(id, array++); - - if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ - return NULL; - - PyList_SET_ITEM(seq, i, wrap); - } - - return seq; - } - /* case IDP_IDPARRAY: TODO */ + switch (prop->type) { + case IDP_STRING: + return idprop_py_from_idp_string(prop); + case IDP_INT: + return idprop_py_from_idp_int(prop); + case IDP_FLOAT: + return idprop_py_from_idp_float(prop); + case IDP_DOUBLE: + return idprop_py_from_idp_double(prop); + case IDP_GROUP: + return idprop_py_from_idp_group(id, prop, parent); + case IDP_ARRAY: + return idprop_py_from_idp_idparray(id, prop); + case IDP_IDPARRAY: /* this could be better a internal type */ + idprop_py_from_idp_array(id, prop); + default: + Py_RETURN_NONE; } - Py_RETURN_NONE; } #if 0 /* UNUSED, currenly assignment overwrites into new properties, rather than setting in-place */ @@ -135,6 +170,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject PyErr_SetString(PyExc_TypeError, "expected a string!"); return -1; } + /* NOTE: if this code is enabled, bytes support needs to be added */ #ifdef USE_STRING_COERCE { int alloc_len; @@ -267,8 +303,7 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item) return NULL; } - return BPy_IDGroup_WrapData(self->id, idprop); - + return BPy_IDGroup_WrapData(self->id, idprop, self->prop); } /*returns NULL on success, error string on failure*/ @@ -506,113 +541,109 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self) return (PyObject*) iter; } +/* for simple, non nested types this is the same as BPy_IDGroup_WrapData */ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) { switch (prop->type) { - case IDP_STRING: - if (prop->subtype == IDP_STRING_SUB_BYTE) { - return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len); - } - else { -#ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); -#else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); -#endif - } - break; + case IDP_STRING: + return idprop_py_from_idp_string(prop); + case IDP_INT: + return idprop_py_from_idp_int(prop); + case IDP_FLOAT: + return idprop_py_from_idp_float(prop); + case IDP_DOUBLE: + return idprop_py_from_idp_double(prop); + case IDP_ARRAY: + { + PyObject *seq = PyList_New(prop->len); + int i; + + if (!seq) { + PyErr_Format(PyExc_RuntimeError, + "%s: IDP_ARRAY: PyList_New(%d) failed", + __func__, prop->len); + return NULL; + } + + switch(prop->subtype) { case IDP_FLOAT: - return PyFloat_FromDouble(*((float*)&prop->data.val)); - break; - case IDP_DOUBLE: - return PyFloat_FromDouble(*((double*)&prop->data.val)); - break; - case IDP_INT: - return PyLong_FromSsize_t( prop->data.val ); - break; - case IDP_ARRAY: { - PyObject *seq = PyList_New(prop->len); - int i; - - if (!seq) { - PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_ARRAY: PyList_New(%d) failed", prop->len); - return NULL; - } - - switch(prop->subtype) { - case IDP_FLOAT: - { - float *array= (float*)IDP_Array(prop); - for (i=0; ilen; i++) { - PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); - } - break; - } - case IDP_DOUBLE: - { - double *array= (double*)IDP_Array(prop); - for (i=0; ilen; i++) { - PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); - } - break; - } - case IDP_INT: - { - int *array= (int*)IDP_Array(prop); - for (i=0; ilen; i++) { - PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i])); - } - break; - } - default: - PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!"); - Py_DECREF(seq); - return NULL; - } - - return seq; - } - case IDP_IDPARRAY: - { - PyObject *seq = PyList_New(prop->len), *wrap; - IDProperty *array= IDP_IDPArray(prop); - int i; - - if (!seq) { - PyErr_Format(PyExc_RuntimeError, "BPy_IDGroup_MapDataToPy, IDP_IDPARRAY: PyList_New(%d) failed", prop->len); - return NULL; - } - + float *array= (float*)IDP_Array(prop); for (i=0; ilen; i++) { - wrap= BPy_IDGroup_MapDataToPy(array++); - - if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ - return NULL; - - PyList_SET_ITEM(seq, i, wrap); + PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); } - return seq; + break; } - case IDP_GROUP: + case IDP_DOUBLE: { - PyObject *dict = PyDict_New(), *wrap; - IDProperty *loop; - - for (loop=prop->data.group.first; loop; loop=loop->next) { - wrap = BPy_IDGroup_MapDataToPy(loop); - - if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ - return NULL; - - PyDict_SetItemString(dict, loop->name, wrap); - Py_DECREF(wrap); + double *array= (double*)IDP_Array(prop); + for (i=0; ilen; i++) { + PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); } - return dict; + break; } + case IDP_INT: + { + int *array= (int*)IDP_Array(prop); + for (i=0; ilen; i++) { + PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i])); + } + break; + } + default: + PyErr_Format(PyExc_RuntimeError, + "%s: invalid/corrupt array type '%d'!", + __func__, prop->subtype); + Py_DECREF(seq); + return NULL; + } + + return seq; + } + case IDP_IDPARRAY: + { + PyObject *seq = PyList_New(prop->len), *wrap; + IDProperty *array= IDP_IDPArray(prop); + int i; + + if (!seq) { + PyErr_Format(PyExc_RuntimeError, + "%s: IDP_IDPARRAY: PyList_New(%d) failed", + __func__, prop->len); + return NULL; + } + + for (i=0; ilen; i++) { + wrap= BPy_IDGroup_MapDataToPy(array++); + + if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ + return NULL; + + PyList_SET_ITEM(seq, i, wrap); + } + return seq; + } + case IDP_GROUP: + { + PyObject *dict = PyDict_New(), *wrap; + IDProperty *loop; + + for (loop=prop->data.group.first; loop; loop=loop->next) { + wrap = BPy_IDGroup_MapDataToPy(loop); + + if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */ + return NULL; + + PyDict_SetItemString(dict, loop->name, wrap); + Py_DECREF(wrap); + } + return dict; + } } - PyErr_Format(PyExc_RuntimeError, "eek!! '%s' property exists with a bad type code '%d' !!!", prop->name, prop->type); + PyErr_Format(PyExc_RuntimeError, + "%s ERROR: '%s' property exists with a bad type code '%d'!", + __func__, prop->name, prop->type); return NULL; } @@ -623,7 +654,9 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) const char *name = _PyUnicode_AsString(value); if (!name) { - PyErr_SetString(PyExc_TypeError, "pop expected at least 1 argument, got 0"); + PyErr_Format(PyExc_TypeError, + "pop expected at least a string argument, not %.200s", + Py_TYPE(value)->tp_name); return NULL; } @@ -676,44 +709,44 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len, PyObject *BPy_Wrap_GetKeys(IDProperty *prop) { - PyObject *seq = PyList_New(prop->len); + PyObject *list = PyList_New(prop->len); IDProperty *loop; int i; for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++) - PyList_SET_ITEM(seq, i, PyUnicode_FromString(loop->name)); + PyList_SET_ITEM(list, i, PyUnicode_FromString(loop->name)); /* if the id prop is corrupt, count the remaining */ for (; loop; loop=loop->next, i++) {} if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */ - BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); - Py_DECREF(seq); /*free the list*/ + BPy_IDGroup_CorrectListLen(prop, list, i, __func__); + Py_DECREF(list); /*free the list*/ /*call self again*/ return BPy_Wrap_GetKeys(prop); } - return seq; + return list; } PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop) { - PyObject *seq = PyList_New(prop->len); + PyObject *list = PyList_New(prop->len); IDProperty *loop; int i; for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) { - PyList_SET_ITEM(seq, i, BPy_IDGroup_WrapData(id, loop)); + PyList_SET_ITEM(list, i, BPy_IDGroup_WrapData(id, loop, prop)); } if (i != prop->len) { - BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); - Py_DECREF(seq); /*free the list*/ + BPy_IDGroup_CorrectListLen(prop, list, i, __func__); + Py_DECREF(list); /*free the list*/ /*call self again*/ return BPy_Wrap_GetValues(id, prop); } - return seq; + return list; } PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop) @@ -725,7 +758,7 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop) for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) { PyObject *item= PyTuple_New(2); PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(loop->name)); - PyTuple_SET_ITEM(item, 1, BPy_IDGroup_WrapData(id, loop)); + PyTuple_SET_ITEM(item, 1, BPy_IDGroup_WrapData(id, loop, prop)); PyList_SET_ITEM(seq, i, item); } @@ -760,7 +793,9 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value) const char *name = _PyUnicode_AsString(value); if (!name) { - PyErr_SetString(PyExc_TypeError, "expected a string"); + PyErr_Format(PyExc_TypeError, + "expected a string, not a %.200s", + Py_TYPE(value)->tp_name); return -1; } @@ -773,7 +808,9 @@ static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value) Py_ssize_t i=0; if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, "expected an object derived from dict"); + PyErr_Format(PyExc_TypeError, + "expected a dict not a %.200s", + Py_TYPE(value)->tp_name); return NULL; } @@ -803,7 +840,7 @@ static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args) idprop= IDP_GetPropertyFromGroup(self->prop, key); if (idprop) { - PyObject* pyobj = BPy_IDGroup_WrapData(self->id, idprop); + PyObject* pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop); if (pyobj) return pyobj; } @@ -912,18 +949,6 @@ PyTypeObject BPy_IDGroup_Type = { BPy_IDGroup_getseters, /* struct PyGetSetDef *tp_getset; */ }; -/*********** Main external wrapping function *******/ -PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent) -{ - BPy_IDProperty *wrap = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type); - wrap->prop = prop; - wrap->parent = parent; - wrap->id = id; - //wrap->destroy = 0; - return (PyObject*) wrap; -} - - /********Array Wrapper********/ static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double) @@ -960,7 +985,10 @@ static PyObject *BPy_IDArray_GetType(BPy_IDArray *self) return PyUnicode_FromString("i"); } - PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!"); + PyErr_Format(PyExc_RuntimeError, + "%s: invalid/corrupt array type '%d'!", + __func__, self->prop->subtype); + return NULL; } @@ -1002,7 +1030,10 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index) return PyLong_FromLong((long)((int*)IDP_Array(self->prop))[index]); } - PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!"); + PyErr_Format(PyExc_RuntimeError, + "%s: invalid/corrupt array type '%d'!", + __func__, self->prop->subtype); + return NULL; } @@ -1165,7 +1196,9 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item) } } else { - PyErr_Format(PyExc_TypeError, "vector indices must be integers, not %.200s", Py_TYPE(item)->tp_name); + PyErr_Format(PyExc_TypeError, + "vector indices must be integers, not %.200s", + __func__, Py_TYPE(item)->tp_name); return NULL; } } @@ -1194,7 +1227,9 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray* self, PyObject* item, PyObject } } else { - PyErr_Format(PyExc_TypeError, "vector indices must be integers, not %.200s", Py_TYPE(item)->tp_name); + PyErr_Format(PyExc_TypeError, + "vector indices must be integers, not %.200s", + Py_TYPE(item)->tp_name); return -1; } } @@ -1311,7 +1346,7 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self) if (self->mode == IDPROP_ITER_ITEMS) { ret = PyTuple_New(2); PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name)); - PyTuple_SET_ITEM(ret, 1, BPy_IDGroup_WrapData(self->group->id, cur)); + PyTuple_SET_ITEM(ret, 1, BPy_IDGroup_WrapData(self->group->id, cur, self->group->prop)); return ret; } else { diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h index 61aad5ed3b9..599ba8e1db6 100644 --- a/source/blender/python/generic/idprop_py_api.h +++ b/source/blender/python/generic/idprop_py_api.h @@ -53,14 +53,13 @@ typedef struct BPy_IDGroup_Iter { int mode; } BPy_IDGroup_Iter; -PyObject *BPy_Wrap_IDProperty(struct ID *id, struct IDProperty *prop, struct IDProperty *parent); PyObject *BPy_Wrap_GetKeys(struct IDProperty *prop); PyObject *BPy_Wrap_GetValues(struct ID *id, struct IDProperty *prop); PyObject *BPy_Wrap_GetItems(struct ID *id, struct IDProperty *prop); int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val); -PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop ); +PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop, struct IDProperty *parent); const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob); void IDProp_Init_Types(void); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6077aa26d4c..b0c1835ac34 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2782,7 +2782,7 @@ static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key) return NULL; } - return BPy_IDGroup_WrapData(self->ptr.id.data, idprop); + return BPy_IDGroup_WrapData(self->ptr.id.data, idprop, group); } static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObject *value) @@ -3892,7 +3892,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) idprop= IDP_GetPropertyFromGroup(group, key); if (idprop) { - return BPy_IDGroup_WrapData(self->ptr.id.data, idprop); + return BPy_IDGroup_WrapData(self->ptr.id.data, idprop, group); } } From 3cf56d46d19773cca897d99201cfa56c20a1b2e1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 10:32:08 +0000 Subject: [PATCH 085/203] add IDP_EqualsProperties support for comparing non-null terminated byte strings. --- source/blender/blenkernel/intern/idprop.c | 6 ++---- source/blender/makesrna/intern/rna_access.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index a07af5161db..a44957ddc01 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -40,8 +40,6 @@ #include "MEM_guardedalloc.h" -#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b)) - /* IDPropertyTemplate is a union in DNA_ID.h */ /*local size table.*/ @@ -464,7 +462,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src) IDProperty *loop, *prop; for (prop=src->data.group.first; prop; prop=prop->next) { for (loop=dest->data.group.first; loop; loop=loop->next) { - if (BSTR_EQ(loop->name, prop->name)) { + if (strcmp(loop->name, prop->name) == 0) { IDProperty *copy = IDP_CopyProperty(prop); BLI_insertlink(&dest->data.group, loop, copy); @@ -635,7 +633,7 @@ int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2) else if(prop1->type == IDP_DOUBLE) return (IDP_Double(prop1) == IDP_Double(prop2)); else if(prop1->type == IDP_STRING) - return BSTR_EQ(IDP_String(prop1), IDP_String(prop2)); + return ((prop1->len == prop2->len) && strncmp(IDP_String(prop1), IDP_String(prop2), prop1->len) == 0); else if(prop1->type == IDP_ARRAY) { if(prop1->len == prop2->len && prop1->subtype == prop2->subtype) return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype]*prop1->len); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 2b31f7184b6..1c68e34791a 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2336,7 +2336,7 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) return idprop->len; } else { - return strlen(IDP_String(idprop)); + return idprop->len - 1; } } else if(sprop->length) From ea0253472209ab6009ea78209158e3c9bd30ba21 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 10:49:02 +0000 Subject: [PATCH 086/203] missed these while rna renaming. --- .../scripts/startup/bl_ui/properties_physics_dynamicpaint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 251606a6341..4e6c4063d2c 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -260,9 +260,9 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): sub.prop(surface, "output_name_a", text="") split = layout.split(percentage=0.4) - split.prop(surface, "do_output_b", text="Wetmaps:") + split.prop(surface, "use_output_b", text="Wetmaps:") sub = split.row() - sub.active = surface.do_output_b + sub.active = surface.use_output_b sub.prop(surface, "output_name_b", text="") else: col = layout.column() From cc93e476abea344495e3288b1aa864c11935c608 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 11:04:29 +0000 Subject: [PATCH 087/203] correct off by one error in previous commit, also add assert incase idproperty length gets out of sync. --- source/blender/makesrna/intern/rna_access.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 1c68e34791a..d3666e28338 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2275,11 +2275,11 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) /* editing bytes is not 100% supported * since they can contain NIL chars */ if (idprop->subtype == IDP_STRING_SUB_BYTE) { - memcpy(value, IDP_String(idprop), idprop->len + 1); + memcpy(value, IDP_String(idprop), idprop->len); value[idprop->len]= '\0'; } else { - strcpy(value, IDP_String(idprop)); + memcpy(value, IDP_String(idprop), idprop->len); } } else if(sprop->get) { @@ -2336,6 +2336,10 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) return idprop->len; } else { +#ifndef NDEBUG + /* these _must_ stay in sync */ + BLI_assert(strlen(IDP_String(idprop)) == idprop->len - 1); +#endif return idprop->len - 1; } } From 5f18cc2238ee8a6839e47c7cfc743416cd09fdbb Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 15 Nov 2011 11:15:37 +0000 Subject: [PATCH 088/203] Bugfix [#29264] Superfluous control in Maintain Volume constraint --- release/scripts/startup/bl_ui/properties_object_constraint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 1ff9a8a0449..038d7a38fd6 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -420,7 +420,9 @@ class ConstraintButtonsPanel(): layout.prop(con, "volume") - self.space_template(layout, con) + row = layout.row() + row.label(text="Convert:") + row.prop(con, "owner_space", text="") def COPY_TRANSFORMS(self, context, layout, con): self.target_template(layout, con) From 1a47f9516ec54775d4bab882a4f59585383b3dbe Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 15 Nov 2011 11:34:49 +0000 Subject: [PATCH 089/203] Formatting cleanup. No functional changes --- source/blender/blenkernel/intern/constraint.c | 131 +++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index adc3f17f187..abcd6903686 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3936,15 +3936,15 @@ static bConstraintTypeInfo CTI_PIVOT = { static void followtrack_new_data (void *cdata) { bFollowTrackConstraint *data= (bFollowTrackConstraint *)cdata; - + data->clip= NULL; - data->flag|= FOLLOWTRACK_ACTIVECLIP; + data->flag |= FOLLOWTRACK_ACTIVECLIP; } static void followtrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata) { bFollowTrackConstraint *data= con->data; - + func(con, (ID**)&data->clip, userdata); } @@ -3954,104 +3954,105 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase bFollowTrackConstraint *data= con->data; MovieClip *clip= data->clip; MovieTrackingTrack *track; - - if(data->flag&FOLLOWTRACK_ACTIVECLIP) + + if (data->flag & FOLLOWTRACK_ACTIVECLIP) clip= scene->clip; - - if(!clip || !data->track[0]) + + if (!clip || !data->track[0]) return; - + track= BKE_tracking_named_track(&clip->tracking, data->track); - - if(!track) + + if (!track) return; - - if(data->flag&FOLLOWTRACK_USE_3D_POSITION) { - if(track->flag&TRACK_HAS_BUNDLE) { + + if (data->flag & FOLLOWTRACK_USE_3D_POSITION) { + if (track->flag & TRACK_HAS_BUNDLE) { float pos[3], mat[4][4], obmat[4][4]; - + copy_m4_m4(obmat, cob->matrix); - + BKE_get_tracking_mat(cob->scene, NULL, mat); mul_v3_m4v3(pos, mat, track->bundle_pos); - - cob->matrix[3][0]+= pos[0]; - cob->matrix[3][1]+= pos[1]; - cob->matrix[3][2]+= pos[2]; + + cob->matrix[3][0] += pos[0]; + cob->matrix[3][1] += pos[1]; + cob->matrix[3][2] += pos[2]; } - } else { + } + else { Object *camob= cob->scene->camera; - - if(camob) { + + if (camob) { MovieClipUser user; MovieTrackingMarker *marker; float vec[3], disp[3], axis[3], mat[4][4]; float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp); - float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.f; - + float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f; + where_is_object_mat(scene, camob, mat); - + /* camera axis */ - vec[0]= 0.f; - vec[1]= 0.f; - vec[2]= 1.f; + vec[0]= 0.0f; + vec[1]= 0.0f; + vec[2]= 1.0f; mul_v3_m4v3(axis, mat, vec); - + /* distance to projection plane */ copy_v3_v3(vec, cob->matrix[3]); sub_v3_v3(vec, mat[3]); project_v3_v3v3(disp, vec, axis); - + len= len_v3(disp); - - if(len>FLT_EPSILON) { + + if (len > FLT_EPSILON) { float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f; short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO; Camera *cam= NULL; - + user.framenr= scene->r.cfra; marker= BKE_tracking_get_marker(track, user.framenr); - + add_v2_v2v2(pos, marker->pos, track->offset); - + object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit); - - if(is_ortho) { - if(cam) + + if (is_ortho) { + if (cam) ortho_scale= cam->ortho_scale; - + vec[0]= ortho_scale * (pos[0]-0.5f+shiftx); vec[1]= ortho_scale * (pos[1]-0.5f+shifty); vec[2]= -len; - - if(aspect>1.f) vec[1]/= aspect; - else vec[0]*= aspect; - + + if (aspect > 1.0f) vec[1] /= aspect; + else vec[0] *= aspect; + mul_v3_m4v3(disp, camob->obmat, vec); - + copy_m4_m4(rmat, camob->obmat); zero_v3(rmat[3]); mul_m4_m4m4(cob->matrix, rmat, cob->matrix); - + copy_v3_v3(cob->matrix[3], disp); } else { - d= (len*sensor_x) / (2.f*lens); - - vec[0]= d*(2.f*(pos[0]+shiftx)-1.f); - vec[1]= d*(2.f*(pos[1]+shifty)-1.f); + d= (len*sensor_x) / (2.0f*lens); + + vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f); + vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f); vec[2]= -len; - - if(aspect>1.f) vec[1]/= aspect; - else vec[0]*= aspect; - + + if (aspect > 1.0f) vec[1] /= aspect; + else vec[0] *= aspect; + mul_v3_m4v3(disp, camob->obmat, vec); - + /* apply camera rotation so Z-axis would be co-linear */ copy_m4_m4(rmat, camob->obmat); zero_v3(rmat[3]); mul_m4_m4m4(cob->matrix, rmat, cob->matrix); - + copy_v3_v3(cob->matrix[3], disp); } } @@ -4080,15 +4081,15 @@ static bConstraintTypeInfo CTI_FOLLOWTRACK = { static void camerasolver_new_data (void *cdata) { bCameraSolverConstraint *data= (bCameraSolverConstraint *)cdata; - - data->clip= NULL; - data->flag|= CAMERASOLVER_ACTIVECLIP; + + data->clip = NULL; + data->flag |= CAMERASOLVER_ACTIVECLIP; } static void camerasolver_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata) { bCameraSolverConstraint *data= con->data; - + func(con, (ID**)&data->clip, userdata); } @@ -4097,15 +4098,15 @@ static void camerasolver_evaluate (bConstraint *con, bConstraintOb *cob, ListBas Scene *scene= cob->scene; bCameraSolverConstraint *data= con->data; MovieClip *clip= data->clip; - - if(data->flag&CAMERASOLVER_ACTIVECLIP) + + if (data->flag & CAMERASOLVER_ACTIVECLIP) clip= scene->clip; - - if(clip) { + + if (clip) { float mat[4][4], obmat[4][4]; - + BKE_tracking_get_interpolated_camera(&clip->tracking, scene->r.cfra, mat); - + copy_m4_m4(obmat, cob->matrix); mul_m4_m4m4(cob->matrix, mat, obmat); } From 6a340c1eb066192ee98c830a526e85905f320446 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 11:56:54 +0000 Subject: [PATCH 090/203] py/rna api was calling RNA_property_type more often then needed (no functional change) --- source/blender/blenkernel/intern/texture.c | 2 +- source/blender/python/intern/bpy_rna.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index db4d09e38b3..a67a61c7638 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -252,7 +252,7 @@ void init_tex_mapping(TexMapping *texmap) size_to_mat3(smat, texmap->size); /* rotation */ - /* XXX TexMapping rotation are now in radians. */ + /* TexMapping rotation are now in radians. */ eul_to_mat3(rmat, texmap->rot); /* compose it all */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b0c1835ac34..f1916355971 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -598,7 +598,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) int subtype, totdim; int len; int is_thick; - int flag= RNA_property_flag(prop); + const int flag= RNA_property_flag(prop); /* disallow dynamic sized arrays to be wrapped since the size could change * to a size mathutils does not support */ @@ -614,7 +614,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) if (!is_thick) ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */ - switch(RNA_property_subtype(prop)) { + switch(subtype) { case PROP_ALL_VECTOR_SUBTYPES: if (len>=2 && len <= 4) { if (is_thick) { @@ -902,7 +902,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) } /* if a pointer, try to print name of pointer target too */ - if (RNA_property_type(self->prop) == PROP_POINTER) { + if (type == PROP_POINTER) { ptr= RNA_property_pointer_get(&self->ptr, self->prop); name= RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL); @@ -916,7 +916,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) return ret; } } - if (RNA_property_type(self->prop) == PROP_COLLECTION) { + if (type == PROP_COLLECTION) { PointerRNA r_ptr; if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { return PyUnicode_FromFormat("", @@ -1301,7 +1301,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) { PyObject *ret; - int type= RNA_property_type(prop); + const int type= RNA_property_type(prop); if (RNA_property_array_check(prop)) { return pyrna_py_from_array(ptr, prop); @@ -1320,7 +1320,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) break; case PROP_STRING: { - int subtype= RNA_property_subtype(prop); + const int subtype= RNA_property_subtype(prop); const char *buf; int buf_len; char buf_fixed[32]; @@ -1458,7 +1458,7 @@ static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func) static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix) { /* XXX hard limits should be checked here */ - int type= RNA_property_type(prop); + const int type= RNA_property_type(prop); if (RNA_property_array_check(prop)) { @@ -1542,7 +1542,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } case PROP_STRING: { - int subtype= RNA_property_subtype(prop); + const int subtype= RNA_property_subtype(prop); const char *param; if (subtype == PROP_BYTESTRING) { @@ -4411,8 +4411,8 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; - int type= RNA_property_type(prop); - int flag= RNA_property_flag(prop); + const int type= RNA_property_type(prop); + const int flag= RNA_property_flag(prop); if (RNA_property_array_check(prop)) { int a, len; @@ -4488,7 +4488,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat { char *data_ch; PyObject *value_coerce= NULL; - int subtype= RNA_property_subtype(prop); + const int subtype= RNA_property_subtype(prop); if (flag & PROP_THICK_WRAP) data_ch= (char *)data; From 355710f414195c1f956a3c98057f6fa7d6a1ab57 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 15 Nov 2011 12:02:44 +0000 Subject: [PATCH 091/203] Follow-up commit to r.41765 Reviewed behaviour of selection operators, and decided that ultimately, it's better if select left/right/column didn't change the channel selections at all. This is because with the highlighting of the active curve nowadays, it's a bit distracting to suddenly lose track of it after performing these operations, when you may have been trying to select all of the keyframes on that curve for further tweaking. --- .../editors/space_graph/graph_select.c | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 6506933df54..9fb880e0bc6 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -81,8 +81,9 @@ * 0 = deselect * 1 = select * 2 = invert + * - do_channels: whether to affect selection status of channels */ -static void deselect_graph_keys (bAnimContext *ac, short test, short sel) +static void deselect_graph_keys (bAnimContext *ac, short test, short sel, short do_channels) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -121,19 +122,22 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel) /* Keyframes First */ ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL); - /* only change selection of channel when the visibility of keyframes doesn't depend on this */ - if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) { - /* deactivate the F-Curve, and deselect if deselecting keyframes. - * otherwise select the F-Curve too since we've selected all the keyframes - */ - if (sel == SELECT_SUBTRACT) - fcu->flag &= ~FCURVE_SELECTED; - else - fcu->flag |= FCURVE_SELECTED; + /* affect channel selection status? */ + if (do_channels) { + /* only change selection of channel when the visibility of keyframes doesn't depend on this */ + if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) { + /* deactivate the F-Curve, and deselect if deselecting keyframes. + * otherwise select the F-Curve too since we've selected all the keyframes + */ + if (sel == SELECT_SUBTRACT) + fcu->flag &= ~FCURVE_SELECTED; + else + fcu->flag |= FCURVE_SELECTED; + } + + /* always deactivate all F-Curves if we perform batch ops for selection */ + fcu->flag &= ~FCURVE_ACTIVE; } - - /* always deactivate all F-Curves if we perform batch ops for selection */ - fcu->flag &= ~FCURVE_ACTIVE; } /* Cleanup */ @@ -152,9 +156,9 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) - deselect_graph_keys(&ac, 0, SELECT_INVERT); + deselect_graph_keys(&ac, 0, SELECT_INVERT, TRUE); else - deselect_graph_keys(&ac, 1, SELECT_ADD); + deselect_graph_keys(&ac, 1, SELECT_ADD, TRUE); /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL); @@ -735,7 +739,7 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short /* - deselect all other keyframes, so that just the newly selected remain * - channels aren't deselected, since we don't re-select any as a consequence */ - deselect_graph_keys(ac, 0, SELECT_SUBTRACT); + deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE); } /* set callbacks and editing data */ @@ -1106,8 +1110,8 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_ /* reset selection mode */ select_mode= SELECT_ADD; - /* deselect all other keyframes */ - deselect_graph_keys(ac, 0, SELECT_SUBTRACT); + /* deselect all other keyframes (+ F-Curves too) */ + deselect_graph_keys(ac, 0, SELECT_SUBTRACT, TRUE); /* deselect other channels too, but only only do this if * selection of channel when the visibility of keyframes @@ -1217,7 +1221,6 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short bAnimListElem *ale; int filter; - SpaceIpo *sipo= (SpaceIpo *)ac->sl; KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked; tNearestVertInfo *nvi; @@ -1237,20 +1240,15 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short else if (nvi->fpt) selx= nvi->fpt->vec[0]; - /* if select mode is replace, deselect all keyframes (and channels) first */ + /* if select mode is replace, deselect all keyframes first */ if (select_mode==SELECT_REPLACE) { /* reset selection mode to add to selection */ select_mode= SELECT_ADD; - /* deselect all other keyframes */ - deselect_graph_keys(ac, 0, SELECT_SUBTRACT); - - /* deselect other channels too, but only only do this if - * selection of channel when the visibility of keyframes - * doesn't depend on this + /* - deselect all other keyframes, so that just the newly selected remain + * - channels aren't deselected, since we don't re-select any as a consequence */ - if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE); } /* initialise keyframe editing data */ From 3d724d8df55d56731e49e73c4fead32deef661e3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 12:20:58 +0000 Subject: [PATCH 092/203] Camera tracking: made some options more easy to understand - Changed some names so now people who aren't really familiar with motion tracking can understand what they exactly means - Also cleaned up and rephraded some descriptions - Changed behavior of operator which creates empty for 2d tracks: now it operates on all selected tracks rather than active track only - Added checkbox to enable/disable rotation stabilization --- release/scripts/presets/camera/Sony_A55.py | 5 ++ .../presets/tracking_camera/Sony_A55.py | 11 +++ release/scripts/startup/bl_operators/clip.py | 38 ++++++---- release/scripts/startup/bl_ui/space_clip.py | 36 +++++----- release/scripts/startup/bl_ui/space_view3d.py | 2 +- source/blender/blenkernel/intern/tracking.c | 5 +- .../blender/editors/space_clip/clip_buttons.c | 31 +++++--- source/blender/editors/space_clip/clip_ops.c | 2 +- .../blender/editors/space_clip/tracking_ops.c | 8 +-- source/blender/makesdna/DNA_tracking_types.h | 1 + .../blender/makesrna/intern/rna_movieclip.c | 16 ++--- source/blender/makesrna/intern/rna_space.c | 10 +-- source/blender/makesrna/intern/rna_tracking.c | 72 ++++++++++++++++--- 13 files changed, 166 insertions(+), 71 deletions(-) create mode 100644 release/scripts/presets/camera/Sony_A55.py create mode 100644 release/scripts/presets/tracking_camera/Sony_A55.py diff --git a/release/scripts/presets/camera/Sony_A55.py b/release/scripts/presets/camera/Sony_A55.py new file mode 100644 index 00000000000..0de8198972a --- /dev/null +++ b/release/scripts/presets/camera/Sony_A55.py @@ -0,0 +1,5 @@ +import bpy +bpy.context.object.data.sensor_width = 23.4 +bpy.context.object.data.sensor_height = 15.6 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' + diff --git a/release/scripts/presets/tracking_camera/Sony_A55.py b/release/scripts/presets/tracking_camera/Sony_A55.py new file mode 100644 index 00000000000..f3095c6ec28 --- /dev/null +++ b/release/scripts/presets/tracking_camera/Sony_A55.py @@ -0,0 +1,11 @@ +import bpy +camera = bpy.context.edit_movieclip.tracking.camera + +camera.sensor_width = 23.4 +camera.sensor_height = 15.6 +camera.units = 'MILLIMETERS' +camera.focal_length = 24.0 +camera.pixel_aspect = 1 +camera.k1 = 0.0 +camera.k2 = 0.0 +camera.k3 = 0.0 diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 203a1673c0b..091e3defbf8 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -24,27 +24,27 @@ from bpy.types import Operator from bpy_extras.io_utils import unpack_list +def CLIP_track_view_selected(sc, track): + if track.select_anchor: + return True + + if sc.show_marker_pattern and track.select_pattern: + return True + + if sc.show_marker_search and track.select_search: + return True + + return False + class CLIP_OT_track_to_empty(Operator): """Create an Empty object which will be copying movement of active track""" bl_idname = "clip.track_to_empty" - bl_label = "2D Track to Empty" + bl_label = "Link Empty to Track" bl_options = {'UNDO', 'REGISTER'} - @classmethod - def poll(cls, context): - if context.space_data.type != 'CLIP_EDITOR': - return False - + def _link_track(self, context, track): sc = context.space_data - clip = sc.clip - - return clip and clip.tracking.tracks.active - - def execute(self, context): - sc = context.space_data - clip = sc.clip - track = clip.tracking.tracks.active constraint = None ob = None @@ -65,6 +65,14 @@ class CLIP_OT_track_to_empty(Operator): constraint.track = track.name constraint.use_3d_position = False + def execute(self, context): + sc = context.space_data + clip = sc.clip + + for track in clip.tracking.tracks: + if CLIP_track_view_selected(sc, track): + self._link_track(context, track) + return {'FINISHED'} @@ -179,7 +187,7 @@ class CLIP_OT_delete_proxy(Operator): class CLIP_OT_set_viewport_background(Operator): - """Set current movie clip as a camera background in 3D viewport""" + """Set current movie clip as a camera background in 3D viewport (works only when a 3D viewport is visible)""" bl_idname = "clip.set_viewport_background" bl_label = "Set as Background" diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 968c583f1fe..c6af6bab1d1 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -55,7 +55,11 @@ class CLIP_HT_header(Header): if sc.show_filters: row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN', text="Filters") - row.prop(sc, "show_graph_frames", icon='SEQUENCE', text="") + + sub = row.column() + sub.active = clip.tracking.reconstruction.is_valid + sub.prop(sc, "show_graph_frames", icon='SEQUENCE', text="") + row.prop(sc, "show_graph_tracks", icon='ANIM', text="") else: row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT', text="Filters") @@ -130,16 +134,16 @@ class CLIP_PT_tools_tracking(Panel): props = col.operator("clip.clear_track_path", text="Clear Before") props.action = 'UPTO' - props = col.operator("clip.clear_track_path", text="Clear Track Path") + props = col.operator("clip.clear_track_path", text="Clear") props.action = 'ALL' - layout.operator("clip.join_tracks") + layout.operator("clip.join_tracks", text="Join") -class CLIP_PT_tools_solving(Panel): +class CLIP_PT_tools_solve(Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' - bl_label = "Solving" + bl_label = "Solve" @classmethod def poll(cls, context): @@ -154,7 +158,7 @@ class CLIP_PT_tools_solving(Panel): settings = clip.tracking.settings col = layout.column(align=True) - col.operator("clip.solve_camera") + col.operator("clip.solve_camera", text="Camera Motion") col.operator("clip.clear_solution") col = layout.column(align=True) @@ -405,8 +409,8 @@ class CLIP_PT_display(Panel): col.prop(sc, "show_disabled", "Disabled Tracks") col.prop(sc, "show_bundles", text="Bundles") - col.prop(sc, "show_names", text="Track Names") - col.prop(sc, "show_tiny_markers", text="Tiny Markers") + col.prop(sc, "show_names", text="Track Names and Status") + col.prop(sc, "show_tiny_markers", text="Compact Markers") col.prop(sc, "show_grease_pencil", text="Grease Pencil") col.prop(sc, "use_mute_footage", text="Mute") @@ -421,7 +425,7 @@ class CLIP_PT_display(Panel): clip = sc.clip if clip: - col.label(text="Display Aspect:") + col.label(text="Display Aspect Ratio:") col.prop(clip, "display_aspect", text="") @@ -496,23 +500,21 @@ class CLIP_PT_stabilization(Panel): layout.prop(stab, "influence_location") - layout.separator() - layout.prop(stab, "use_autoscale") col = layout.column() col.active = stab.use_autoscale col.prop(stab, "scale_max") col.prop(stab, "influence_scale") - layout.separator() + layout.prop(stab, "use_stabilize_rotation") + col = layout.column() + col.active = stab.use_stabilize_rotation - layout.label(text="Rotation:") - - row = layout.row(align=True) + row = col.row(align=True) row.prop_search(stab, "rotation_track", tracking, "tracks", text="") row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN') - row = layout.row() + row = col.row() row.active = stab.rotation_track is not None row.prop(stab, "influence_rotation") @@ -854,6 +856,7 @@ class CLIP_MT_tracking_specials(Menu): class CLIP_MT_camera_presets(Menu): + """Predefined tracking camera intrinsics""" bl_label = "Camera Presets" preset_subdir = "tracking_camera" preset_operator = "script.execute_preset" @@ -861,6 +864,7 @@ class CLIP_MT_camera_presets(Menu): class CLIP_MT_track_color_presets(Menu): + """Predefined track color""" bl_label = "Color Presets" preset_subdir = "tracking_track_color" preset_operator = "script.execute_preset" diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 97e40bfff30..2bfbd15cf55 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2204,7 +2204,7 @@ class VIEW3D_PT_view3d_motion_tracking(Panel): col = layout.column() col.active = view.show_reconstruction - col.prop(view, "show_tracks_name", text="Show Names") + col.prop(view, "show_tracks_name") col.prop(view, "show_camera_path") col.label(text="Tracks:") col.prop(view, "tracks_draw_type", text="") diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index d582ad7c4d8..59fdf403f0f 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1874,7 +1874,7 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width mul_v2_fl(loc, stab->locinf); - if(stab->rot_track && stab->rotinf) { + if((stab->flag&TRACKING_STABILIZE_ROTATION) && stab->rot_track && stab->rotinf) { MovieTrackingMarker *marker; float a[2], b[2]; float x0= (float)width/2.0f, y0= (float)height/2.0f; @@ -1916,7 +1916,8 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, track= tracking->tracks.first; while(track) { - if(track->flag&TRACK_USE_2D_STAB || track==stab->rot_track) { + if(track->flag&TRACK_USE_2D_STAB || + ((stab->flag&TRACKING_STABILIZE_ROTATION) && track==stab->rot_track)) { if(track->markersnr) { sfra= MIN2(sfra, track->markers[0].framenr); efra= MAX2(efra, track->markers[track->markersnr-1].framenr); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 149aa9106b0..43eb45b17a7 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -320,6 +320,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P MovieTrackingTrack *track; MovieTrackingMarker *marker; MarkerUpdateCb *cb; + const char *tip; if(!ptr->data) return; @@ -353,7 +354,12 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P if(compact) { block= uiLayoutGetBlock(layout); - bt= uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, "Marker is disabled for current frame."); + if(cb->marker_flag&MARKER_DISABLED) + tip= "Marker is disabled at current frame"; + else + tip= "Marker is enabled at current frame"; + + bt= uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip); uiButSetNFunc(bt, marker_update_cb, cb, NULL); } else { int width, height, step, digits; @@ -394,8 +400,13 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P uiBlockSetHandleFunc(block, marker_block_handler, cb); uiBlockSetNFunc(block, marker_update_cb, cb, NULL); + if(cb->marker_flag&MARKER_DISABLED) + tip= "Marker is disabled at current frame"; + else + tip= "Marker is enabled at current frame"; + uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag, - 0, 0, 0, 0, "Marker is disabled for current frame."); + 0, 0, 0, 0, tip); col= uiLayoutColumn(layout, 1); uiLayoutSetActive(col, (cb->marker_flag&MARKER_DISABLED)==0); @@ -405,21 +416,21 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P uiDefBut(block, LABEL, 0, "Position:", 0, 190, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_POS, "X:", 10, 171, 145, 19, &cb->marker_pos[0], - -10*width, 10.0*width, step, digits, "X-position of marker at frame in screen coordinates."); + -10*width, 10.0*width, step, digits, "X-position of marker at frame in screen coordinates"); uiDefButF(block, NUM, B_MARKER_POS, "Y:", 165, 171, 145, 19, &cb->marker_pos[1], - -10*height, 10.0*height, step, digits, "Y-position of marker at frame in screen coordinates."); + -10*height, 10.0*height, step, digits, "Y-position of marker at frame in screen coordinates"); uiDefBut(block, LABEL, 0, "Offset:", 0, 152, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_OFFSET, "X:", 10, 133, 145, 19, &cb->track_offset[0], - -10*width, 10.0*width, step, digits, "X-offset to parenting point."); + -10*width, 10.0*width, step, digits, "X-offset to parenting point"); uiDefButF(block, NUM, B_MARKER_OFFSET, "Y:", 165, 133, 145, 19, &cb->track_offset[1], - -10*height, 10.0*height, step, digits, "Y-offset to parenting point."); + -10*height, 10.0*height, step, digits, "Y-offset to parenting point"); uiDefBut(block, LABEL, 0, "Pattern Area:", 0, 114, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Width:", 10, 95, 300, 19, &cb->track_pat[0], 3.0f, - 10.0*width, step, digits, "Width of marker's pattern in screen soordinates."); + 10.0*width, step, digits, "Width of marker's pattern in screen coordinates"); uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Height:", 10, 76, 300, 19, &cb->track_pat[1], 3.0f, - 10.0*height, step, digits, "Height of marker's pattern in screen soordinates."); + 10.0*height, step, digits, "Height of marker's pattern in screen coordinates"); uiDefBut(block, LABEL, 0, "Search Area:", 0, 57, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "X:", 10, 38, 145, 19, &cb->track_search_pos[0], @@ -427,9 +438,9 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "Y:", 165, 38, 145, 19, &cb->track_search_pos[1], -height, height, step, digits, "X-position of search at frame relative to marker's position"); uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Width:", 10, 19, 300, 19, &cb->track_search[0], 3.0f, - 10.0*width, step, digits, "Width of marker's search in screen soordinates."); + 10.0*width, step, digits, "Width of marker's search in screen soordinates"); uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Height:", 10, 0, 300, 19, &cb->track_search[1], 3.0f, - 10.0*height, step, digits, "Height of marker's search in screen soordinates."); + 10.0*height, step, digits, "Height of marker's search in screen soordinates"); uiBlockEndAlign(block); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index d713303ca8b..c4a858797e5 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -929,7 +929,7 @@ void CLIP_OT_rebuild_proxy(wmOperatorType *ot) /* identifiers */ ot->name= "Rebuild Proxy and Timecode Indices"; ot->idname= "CLIP_OT_rebuild_proxy"; - ot->description="Rebuild all selected proxies and timecode indeces using the job system"; + ot->description= "Rebuild all selected proxies and timecode indeces in the background"; /* api callbacks */ ot->exec= sequencer_rebuild_proxy_exec; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1b08a9aee4c..1dd5611c4b7 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1653,7 +1653,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot) /* identifiers */ ot->name= "Clear Track Path"; - ot->description= "Clear path of selected tracks"; + ot->description= "Clear tracks after/before current position or cleat the whole track"; ot->idname= "CLIP_OT_clear_track_path"; /* api callbacks */ @@ -2119,7 +2119,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot) { /* identifiers */ ot->name= "Set Principal to Center"; - ot->description= "Set principal point to center of footage"; + ot->description= "Set optical center to center of footage"; ot->idname= "CLIP_OT_set_center_principal"; /* api callbacks */ @@ -2285,7 +2285,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot) /* identifiers */ ot->name= "Detect Features"; - ot->description= "Automatically detect features to track"; + ot->description= "Automatically detect features and place markers to track"; ot->idname= "CLIP_OT_detect_features"; /* api callbacks */ @@ -2910,7 +2910,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot) /* identifiers */ ot->name= "Clean Tracks"; - ot->description= "Clean tracks"; + ot->description= "Clean tracks with low trackness or high error"; ot->idname= "CLIP_OT_clean_tracks"; /* api callbacks */ diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index e1aff048626..cbac3721ac3 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -217,6 +217,7 @@ enum { /* MovieTrackingStrabilization->flag */ #define TRACKING_2D_STABILIZATION (1<<0) #define TRACKING_AUTOSCALE (1<<1) +#define TRACKING_STABILIZE_ROTATION (1<<2) /* MovieTrackingReconstruction->flag */ #define TRACKING_RECONSTRUCTED (1<<0) diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 91e082cdeae..acb70e9fde2 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -87,19 +87,19 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* build proxy sized */ prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_25); - RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution"); + RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension"); prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_50); - RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution"); + RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension"); prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_75); - RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution"); + RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension"); prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_100); - RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution"); + RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension"); prop= RNA_def_property(srna, "build_undistorted", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_flag", MCLIP_PROXY_BUILD_UNDISTORT); @@ -121,7 +121,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* quality of proxied image */ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "quality"); - RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build"); + RNA_def_property_ui_text(prop, "Quality", "JPEG of proxy images"); RNA_def_property_ui_range(prop, 1, 100, 1, 0); prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); @@ -169,7 +169,7 @@ static void rna_def_moviecliUser(BlenderRNA *brna) /* render undistorted */ prop= RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT); - RNA_def_property_ui_text(prop, "Render Undistorted", "Draw preview using undistorted proxy"); + RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); } @@ -198,7 +198,7 @@ static void rna_def_movieclip(BlenderRNA *brna) prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "File Path", "Filename of the text file"); + RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); prop= RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE); @@ -234,7 +234,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* custom proxy directory */ prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR); - RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); + RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); /* grease pencil */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d2505fc9775..8fb232332d5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1593,12 +1593,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH); - RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed path of camera"); + RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed camera path"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_tracks_name", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME); - RNA_def_property_ui_text(prop, "Show Tracks Name", "Show names for tracks objects"); + RNA_def_property_ui_text(prop, "Show Track Names", "Show names for tracks objects"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* region */ @@ -2893,7 +2893,7 @@ static void rna_def_space_clip(BlenderRNA *brna) /* show tiny markers */ prop= RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers tiny"); + RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers in a more compact manner"); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TINY_MARKER); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); @@ -2960,13 +2960,13 @@ static void rna_def_space_clip(BlenderRNA *brna) /* show graph_frames */ prop= RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES); - RNA_def_property_ui_text(prop, "Show Frames", "Show curves for frames in graph editor"); + RNA_def_property_ui_text(prop, "Show Frames", "Show curve for per-frame average error (camera motion should be solved first)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); /* show graph_tracks */ prop= RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS); - RNA_def_property_ui_text(prop, "Show Tracks", "Show curves for tracks in graph editor"); + RNA_def_property_ui_text(prop, "Show Tracks", "Display the speed curves (in \"x\" direction red, in \"y\" direction green) for the selected tracks"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); } diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 4de39811d0b..368359925c4 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -39,6 +39,7 @@ #include "rna_internal.h" #include "DNA_movieclip_types.h" +#include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" #include "WM_types.h" @@ -94,6 +95,29 @@ void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value) BKE_track_unique_name(&clip->tracking, track); } +static int rna_trackingTrack_select_get(PointerRNA *ptr) +{ + MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data; + + return TRACK_SELECTED(track); +} + +static void rna_trackingTrack_select_set(PointerRNA *ptr, int value) +{ + MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data; + + if(value) { + track->flag|= SELECT; + track->pat_flag|= SELECT; + track->search_flag|= SELECT; + } + else { + track->flag&= ~SELECT; + track->pat_flag&= ~SELECT; + track->search_flag&= ~SELECT; + } +} + static void rna_tracking_trackerPattern_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data; @@ -253,14 +277,14 @@ static void rna_def_trackingSettings(BlenderRNA *brna) prop= RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, speed_items); - RNA_def_property_ui_text(prop, "Speed", "Speed to make tracking with"); + RNA_def_property_ui_text(prop, "Speed", "Limit speed of tracking to make visual feedback easier (this does not affect the tracking quality)"); /* limit frames */ prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "frames_limit"); RNA_def_property_range(prop, 0, SHRT_MAX); - RNA_def_property_ui_text(prop, "Frames Limit", "Amount of frames to be tracked during single tracking operation"); + RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this amount of frames are tracked"); /* adjust frames */ prop= RNA_def_property(srna, "frames_adjust", PROP_INT, PROP_NONE); @@ -274,7 +298,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0, 300); - RNA_def_property_ui_text(prop, "Margin", "Margin for markers from image boundary"); + RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking"); /* keyframe_a */ prop= RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE); @@ -398,7 +422,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "pixel_aspect"); RNA_def_property_range(prop, 0.1f, 5000.0f); RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2); - RNA_def_property_ui_text(prop, "Pixel Aspect", "Pixel aspect ratio"); + RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); } @@ -441,8 +465,8 @@ static void rna_def_trackingTrack(BlenderRNA *brna) PropertyRNA *parm; static EnumPropertyItem tracker_items[] = { - {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker"}, - {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker"}, + {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"}, + {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when MLT tracker fails"}, {0, NULL, 0, NULL, NULL}}; rna_def_trackingMarker(brna); @@ -501,7 +525,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "pyramid_levels"); RNA_def_property_range(prop, 1, 16); - RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels for KLT tracking"); + RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update"); /* minmal correlation - only used for SAD tracker */ @@ -557,6 +581,30 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Hide", "Track is hidden"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); + /* select */ + prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_trackingTrack_select_get", "rna_trackingTrack_select_set"); + RNA_def_property_ui_text(prop, "Select", "Track is selected"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); + + /* select_anchor */ + prop= RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); + RNA_def_property_ui_text(prop, "Select Anchor", "Track's anchor point is selected"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); + + /* select_pattern */ + prop= RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "pat_flag", SELECT); + RNA_def_property_ui_text(prop, "Select Pattern", "Track's pattern area is selected"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); + + /* select_search */ + prop= RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "search_flag", SELECT); + RNA_def_property_ui_text(prop, "Select Search", "Track's search area is selected"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); + /* locked */ prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED); @@ -573,7 +621,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Color", "Color of the track in the Clip Editor"); + RNA_def_property_ui_text(prop, "Color", "Color of the track in the Movie Track Editor and the 3D viewport after a solve"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); /* average error */ @@ -636,7 +684,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) prop= RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "maxscale"); RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Miximal Scale", "Maximal value for scale factor"); + RNA_def_property_ui_text(prop, "Maximal Scale", "Limits the amount of automatic scaling"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); /* influence_location */ @@ -653,6 +701,12 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Scale Influence", "Influence of stabilization algorithm on footage scale"); RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); + /* use_stabilize_rotation */ + prop= RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION); + RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize horizon line on the shot"); + RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate"); + /* influence_rotation */ prop= RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "rotinf"); From 735eb3774b0965704400f877f2a4c1c819003bc3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 12:28:13 +0000 Subject: [PATCH 093/203] patch [#27708] API for adding mesh properties from Geoffrey Bantle (briggs) --- source/blender/makesrna/intern/rna_mesh.c | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 48a4d055520..63a7df09792 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1146,6 +1146,45 @@ static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bConte return cdl; } +static CustomDataLayer *rna_Mesh_int_property_new(struct Mesh *me, struct bContext *C, const char *name) +{ + CustomDataLayer *cdl = NULL; + int index; + + CustomData_add_layer_named(&me->fdata, CD_PROP_INT, CD_DEFAULT, NULL, me->totface, name); + index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_INT, name); + + cdl = (index == -1) ? NULL : &(me->fdata.layers[index]); + + return cdl; +} + +static CustomDataLayer *rna_Mesh_float_property_new(struct Mesh *me, struct bContext *C, const char *name) +{ + CustomDataLayer *cdl = NULL; + int index; + + CustomData_add_layer_named(&me->fdata, CD_PROP_FLT, CD_DEFAULT, NULL, me->totface, name); + index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_FLT, name); + + cdl = (index == -1) ? NULL : &(me->fdata.layers[index]); + + return cdl; +} + +static CustomDataLayer *rna_Mesh_string_property_new(struct Mesh *me, struct bContext *C, const char *name) +{ + CustomDataLayer *cdl = NULL; + int index; + + CustomData_add_layer_named(&me->fdata, CD_PROP_STR, CD_DEFAULT, NULL, me->totface, name); + index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_STR, name); + + cdl = (index == -1) ? NULL : &(me->fdata.layers[index]); + + return cdl; +} + static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name) { CustomData *fdata; @@ -1750,6 +1789,69 @@ static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } +/* mesh int layers */ +static void rna_def_int_layers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "IntProperties"); + srna= RNA_def_struct(brna, "IntProperties", NULL); + RNA_def_struct_sdna(srna, "Mesh"); + RNA_def_struct_ui_text(srna, "Int Properties", "Collection of int properties"); + + func= RNA_def_function(srna, "new", "rna_Mesh_int_property_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a integer property layer to Mesh"); + RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name"); + parm= RNA_def_pointer(func, "layer", "MeshIntPropertyLayer", "", "The newly created layer"); + RNA_def_function_return(func, parm); +} + +/* mesh float layers */ +static void rna_def_float_layers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "FloatProperties"); + srna= RNA_def_struct(brna, "FloatProperties", NULL); + RNA_def_struct_sdna(srna, "Mesh"); + RNA_def_struct_ui_text(srna, "Float Properties", "Collection of float properties"); + + func= RNA_def_function(srna, "new", "rna_Mesh_float_property_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a float property layer to Mesh"); + RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name"); + parm= RNA_def_pointer(func, "layer", "MeshFloatPropertyLayer", "", "The newly created layer"); + RNA_def_function_return(func, parm); +} + +/* mesh string layers */ +static void rna_def_string_layers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "StringProperties"); + srna= RNA_def_struct(brna, "StringProperties", NULL); + RNA_def_struct_sdna(srna, "Mesh"); + RNA_def_struct_ui_text(srna, "String Properties", "Collection of string properties"); + + func= RNA_def_function(srna, "new", "rna_Mesh_string_property_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a string property layer to Mesh"); + RNA_def_string(func, "name", "String Prop", 0, "", "String property name"); + parm= RNA_def_pointer(func, "layer", "MeshStringPropertyLayer", "", "The newly created layer"); + RNA_def_function_return(func, parm); +} + /* mesh.uv_layers */ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) { @@ -1876,6 +1978,7 @@ static void rna_def_mesh(BlenderRNA *brna) "rna_Mesh_float_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); + rna_def_float_layers(brna, prop); prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); @@ -1883,6 +1986,7 @@ static void rna_def_mesh(BlenderRNA *brna) "rna_Mesh_int_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); + rna_def_int_layers(brna, prop); prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); @@ -1890,6 +1994,7 @@ static void rna_def_mesh(BlenderRNA *brna) "rna_Mesh_string_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); + rna_def_string_layers(brna, prop); prop= RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); From eb1e24bbe61f2f00ad37063bb10dd306f521fbd2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 12:32:58 +0000 Subject: [PATCH 094/203] One more description became easier to understand --- source/blender/editors/space_clip/tracking_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1dd5611c4b7..a93ad9724c5 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2910,7 +2910,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot) /* identifiers */ ot->name= "Clean Tracks"; - ot->description= "Clean tracks with low trackness or high error"; + ot->description= "Clean tracks with high error values or few frames"; ot->idname= "CLIP_OT_clean_tracks"; /* api callbacks */ From 3ecb7b951e76388cca68ed07ce1aaf09265ad272 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 13:45:24 +0000 Subject: [PATCH 095/203] fix [#29272] Dynamic Paint crashes on duplicating a particle system smoke had this same bug too --- source/blender/blenkernel/intern/object.c | 22 ++++++++++++++++++-- source/blender/makesdna/DNA_particle_types.h | 5 ++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ffd49ecc57d..dedf2675ff6 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -50,6 +50,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" +#include "DNA_smoke_types.h" #include "DNA_sound_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -961,7 +962,6 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) void copy_object_particlesystems(Object *obn, Object *ob) { - ParticleSystemModifierData *psmd; ParticleSystem *psys, *npsys; ModifierData *md; @@ -974,10 +974,28 @@ void copy_object_particlesystems(Object *obn, Object *ob) /* need to update particle modifiers too */ for(md=obn->modifiers.first; md; md=md->next) { if(md->type==eModifierType_ParticleSystem) { - psmd= (ParticleSystemModifierData*)md; + ParticleSystemModifierData *psmd= (ParticleSystemModifierData*)md; if(psmd->psys==psys) psmd->psys= npsys; } + else if(md->type==eModifierType_DynamicPaint) { + DynamicPaintModifierData *pmd= (DynamicPaintModifierData*)md; + if (pmd->brush) { + if(pmd->brush->psys==psys) { + pmd->brush->psys= npsys; + } + } + } + else if (md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_FLOW) { + if (smd->flow) { + if (smd->flow->psys == psys) + smd->flow->psys= npsys; + } + } + } } } } diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index f4736add66c..11a6460b1fc 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -233,7 +233,10 @@ typedef struct ParticleSettings { struct PartDeflect *pd2; } ParticleSettings; -typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in copy_particlesystem */ +typedef struct ParticleSystem +{ /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */ + /* note2: make sure any uses of this struct in DNA are accounted for in 'copy_object_particlesystems' */ + struct ParticleSystem *next, *prev; ParticleSettings *part; /* particle settings */ From 205b554bef36a2fa7a8d5f39be80b413a5ab0c82 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 14:01:24 +0000 Subject: [PATCH 096/203] access mesh string data layer as bytes since this is low level data storage --- source/blender/makesrna/intern/makesrna.c | 12 ++++++++++-- source/blender/makesrna/intern/rna_mesh.c | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a3054b88960..a464948c3ac 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -524,7 +524,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { const PropertySubType subtype= prop->subtype; - const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8"; + const char *string_copy_func= (subtype==PROP_FILEPATH || + subtype==PROP_DIRPATH || + subtype==PROP_FILENAME || + subtype==PROP_BYTESTRING) ? + "BLI_strncpy" : "BLI_strncpy_utf8"; rna_print_data_get(f, dp); if(sprop->maxlength) @@ -739,7 +743,11 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { const PropertySubType subtype= prop->subtype; - const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8"; + const char *string_copy_func= (subtype==PROP_FILEPATH || + subtype==PROP_DIRPATH || + subtype==PROP_FILENAME || + subtype==PROP_BYTESTRING) ? + "BLI_strncpy" : "BLI_strncpy_utf8"; rna_print_data_get(f, dp); if(sprop->maxlength) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 63a7df09792..421c201b3f8 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1675,7 +1675,8 @@ static void rna_def_mproperties(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Mesh String Property", "User defined string text value in a string properties layer"); RNA_def_struct_path_func(srna, "rna_MeshStringProperty_path"); - prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); + /* low level mesh data access, treat as bytes */ + prop= RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); RNA_def_property_string_sdna(prop, NULL, "s"); RNA_def_property_ui_text(prop, "Value", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); From 47ad078402c7139a6e91038cd40101010fabbc29 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 14:20:57 +0000 Subject: [PATCH 097/203] show tooltips for menus, currently works for operators and enum properties which are can be accessed as menus from the UI (camera overlay enum for example) --- .../blender/editors/interface/interface_layout.c | 16 ++++++++-------- .../editors/interface/interface_regions.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 29d37be1dee..0844b9581e3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1370,7 +1370,7 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) mt->draw(C, &menu); } -static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN) +static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, const char *tip) { uiBlock *block= layout->root->block; uiBut *but; @@ -1393,11 +1393,11 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre w -= 10; if(name[0] && icon) - but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, ""); + but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip); else if(icon) - but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, ""); + but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip); else - but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, ""); + but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip); if(argN) { /* ugly .. */ but->poin= (char*)but; @@ -1430,7 +1430,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(layout->root->type == UI_LAYOUT_MENU && !icon) icon= ICON_BLANK1; - ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL); + ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, ""); /* TODO, menu description */ } /* label item */ @@ -1514,7 +1514,7 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc if(!func) return; - ui_item_menu(layout, name, icon, func, arg, NULL); + ui_item_menu(layout, name, icon, func, arg, NULL, ""); } typedef struct MenuItemLevel { @@ -1560,7 +1560,7 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname)); lvl->opcontext= layout->root->opcontext; - ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl); + ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, ot->description); } static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) @@ -1593,7 +1593,7 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname)); lvl->opcontext= layout->root->opcontext; - ui_item_menu(layout, name, icon, menu_item_enum_rna_menu, NULL, lvl); + ui_item_menu(layout, name, icon, menu_item_enum_rna_menu, NULL, lvl, RNA_property_description(prop)); } /**************************** Layout Items ***************************/ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 837a9d12af1..513f084b6e8 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -398,7 +398,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } } - if(but->tip && strlen(but->tip)) { + if(but->tip && but->tip[0] != '\0') { BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0])); data->color[data->totline]= 0xFFFFFF; data->totline++; From 2bc78219135eba9b8079dc69ea7fd062a283a9b3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 14:58:14 +0000 Subject: [PATCH 098/203] add support for python __doc__ comments in menu classes showing in the tooltip, since menus are used as buttons too. --- source/blender/blenkernel/BKE_screen.h | 1 + .../editors/interface/interface_layout.c | 2 +- source/blender/makesrna/intern/rna_ui.c | 37 ++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 77a351d534e..44b92f70519 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -207,6 +207,7 @@ typedef struct MenuType { char idname[BKE_ST_MAXNAME]; /* unique name */ char label[BKE_ST_MAXNAME]; /* for button text */ + char *description; /* verify if the menu should draw or not */ int (*poll)(const struct bContext *, struct MenuType *); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 0844b9581e3..2529dca5a63 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1430,7 +1430,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(layout->root->type == UI_LAYOUT_MENU && !icon) icon= ICON_BLANK1; - ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, ""); /* TODO, menu description */ + ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, mt->description); } /* label item */ diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 58d6911cf17..1ad9cb00ba1 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -56,6 +56,8 @@ EnumPropertyItem operator_context_items[] = { #ifdef RNA_RUNTIME +#include + #include "MEM_guardedalloc.h" #include "RNA_access.h" @@ -411,6 +413,7 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type) WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } +static char _menu_descr[1024]; static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { @@ -418,11 +421,17 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data Menu dummymenu= {NULL}; PointerRNA dummymtr; int have_function[2]; + size_t over_alloc= 0; /* warning, if this becomes a bess, we better do another alloc */ + size_t description_size= 0; /* setup dummy menu & menu type to store static properties in */ dummymenu.type= &dummymt; + dummymenu.type->description= _menu_descr; RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr); + /* clear incase they are left unset */ + _menu_descr[0]= '\0'; + /* validate the python class */ if(validate(&dummymtr, data, have_function) != 0) return NULL; @@ -439,9 +448,20 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data rna_Menu_unregister(bmain, mt->ext.srna); /* create a new menu type */ - mt= MEM_callocN(sizeof(MenuType), "python buttons menu"); + if (_menu_descr[0]) { + description_size= strlen(_menu_descr) + 1; + over_alloc += description_size; + } + + mt= MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu"); memcpy(mt, &dummymt, sizeof(dummymt)); + if (_menu_descr[0]) { + char *buf= (char *)(mt + 1); + memcpy(buf, _menu_descr, description_size); + mt->description= buf; + } + mt->ext.srna= RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu"); mt->ext.data= data; mt->ext.call= call; @@ -466,6 +486,14 @@ static StructRNA* rna_Menu_refine(PointerRNA *mtr) return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Menu; } +static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) +{ + Menu *data= (Menu*)(ptr->data); + char *str= (char *)data->type->description; + if(!str[0]) strcpy(str, value); + else assert(!"setting the bl_description on a non-builtin menu"); +} + static int rna_UILayout_active_get(PointerRNA *ptr) { return uiLayoutGetActive(ptr->data); @@ -800,6 +828,13 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); + prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + RNA_def_property_string_sdna(prop, NULL, "type->description"); + RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set"); + // RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_define_verify_sdna(1); } From db8024f4b54ac4cf83b5346fe1548c009fd21082 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 15:13:38 +0000 Subject: [PATCH 099/203] Fix #29259: cycles issues on certain processors. Now two versions of the kernel are compiled, one SSE optimized and the other not, and it will choose between them at runtime. --- intern/cycles/CMakeLists.txt | 31 ++++------ intern/cycles/SConscript | 28 +++++---- intern/cycles/device/device_cpu.cpp | 63 +++++++++++++++---- intern/cycles/kernel/CMakeLists.txt | 8 ++- intern/cycles/kernel/kernel.h | 7 ++- intern/cycles/kernel/kernel_optimized.cpp | 60 +++++++++++++++++++ intern/cycles/util/util_system.cpp | 73 +++++++++++++++++++++++ intern/cycles/util/util_system.h | 1 + 8 files changed, 226 insertions(+), 45 deletions(-) create mode 100644 intern/cycles/kernel/kernel_optimized.cpp diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index d1ee5e0050d..cfff7485e61 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -9,31 +9,18 @@ include(cmake/external_libs.cmake) # Build Flags if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD) - set(GCC_OPTIM_FLAGS "-ffast-math -msse -msse2 -msse3") -endif() + set(WITH_CYCLES_OPTIMIZED_KERNEL ON) -if(APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}") - set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") -endif() - -if(WIN32) - if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast") - set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") + if(WIN32 AND MSVC) + set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast") elseif(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}") - set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") + set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -DGOGOGO") endif() endif() -if(UNIX AND NOT APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}") - set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") -endif() - -# not needed yet, is for open shading language -set(RTTI_DISABLE_FLAGS "") +# for OSL, not needed yet +# set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") +# set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") # Definitions and Includes @@ -42,6 +29,10 @@ add_definitions(${BOOST_DEFINITIONS} ${OPENIMAGEIO_DEFINITIONS}) add_definitions(-DCCL_NAMESPACE_BEGIN=namespace\ ccl\ {) add_definitions(-DCCL_NAMESPACE_END=}) +if(WITH_CYCLES_OPTIMIZED_KERNEL) + add_definitions(-DWITH_OPTIMIZED_KERNEL) +endif() + if(WITH_CYCLES_NETWORK) add_definitions(-DWITH_NETWORK) endif() diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index e2c81edea37..1acb7321f09 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -10,11 +10,10 @@ sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob(' sources.remove(path.join('util', 'util_view.cpp')) sources.remove(path.join('render', 'film_response.cpp')) +sources.remove(path.join('kernel', 'kernel_optimized.cpp')) incs = [] defs = [] -ccflags = [] -cxxflags = [] defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {') defs.append('CCL_NAMESPACE_END=}') @@ -23,14 +22,6 @@ defs.append('WITH_OPENCL') defs.append('WITH_MULTI') defs.append('WITH_CUDA') -if env['OURPLATFORM'] in ('win32-mingw'): - if env['WITH_BF_RAYOPTIMIZATION']: - cxxflags.append('-ffast-math -msse -msse2 -msse3'.split()) - ccflags.append('-ffast-math -msse -msse2 -msse3'.split()) - # not needed yet, is for open shading language - # cxxflags.append('-fno-rtti'.split()) - # defs.append('BOOST_NO_RTTI BOOST_NO_TYPEID'.split()) - incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split()) incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) @@ -39,5 +30,20 @@ incs.append(cycles['BF_OIIO_INC']) incs.append(cycles['BF_BOOST_INC']) incs.append(cycles['BF_PYTHON_INC']) -cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], compileflags=[None], cc_compileflags=ccflags, cxx_compileflags=cxxflags) +# optimized kernel +if env['WITH_BF_RAYOPTIMIZATION']: + optim_cxxflags = [] + + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + optim_cxxflags.append('/Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast'.split()) + else: + optim_cxxflags.append('-ffast-math -msse -msse2 -msse3'.split()) + + optim_defs = defs + ['WITH_OPTIMIZED_KERNEL'] + optim_sources = [path.join('kernel', 'kernel_optimized.cpp')] + + cycles_optim = cycles.Clone() + cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[0], compileflags=[None], cxx_compileflags=optim_cxxflags) + +cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], compileflags=[None]) diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index d6e1c200996..990b7cb94b0 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -48,6 +48,9 @@ public: { kg = kernel_globals_create(); + /* do now to avoid thread issues */ + system_cpu_support_optimized(); + if(threads_num == 0) threads_num = system_cpu_thread_count(); @@ -155,12 +158,26 @@ public: OSLShader::thread_init(kg); #endif - for(int y = task.y; y < task.y + task.h; y++) { - for(int x = task.x; x < task.x + task.w; x++) - kernel_cpu_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state, task.sample, x, y); +#ifdef WITH_OPTIMIZED_KERNEL + if(system_cpu_support_optimized()) { + for(int y = task.y; y < task.y + task.h; y++) { + for(int x = task.x; x < task.x + task.w; x++) + kernel_cpu_optimized_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state, task.sample, x, y); - if(tasks.worker_cancel()) - break; + if(tasks.worker_cancel()) + break; + } + } + else +#endif + { + for(int y = task.y; y < task.y + task.h; y++) { + for(int x = task.x; x < task.x + task.w; x++) + kernel_cpu_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state, task.sample, x, y); + + if(tasks.worker_cancel()) + break; + } } #ifdef WITH_OSL @@ -171,9 +188,18 @@ public: void thread_tonemap(DeviceTask& task) { - for(int y = task.y; y < task.y + task.h; y++) { - for(int x = task.x; x < task.x + task.w; x++) - kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer, task.sample, task.resolution, x, y); +#ifdef WITH_OPTIMIZED_KERNEL + if(system_cpu_support_optimized()) { + for(int y = task.y; y < task.y + task.h; y++) + for(int x = task.x; x < task.x + task.w; x++) + kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer, task.sample, task.resolution, x, y); + } + else +#endif + { + for(int y = task.y; y < task.y + task.h; y++) + for(int x = task.x; x < task.x + task.w; x++) + kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer, task.sample, task.resolution, x, y); } } @@ -184,11 +210,24 @@ public: OSLShader::thread_init(kg); #endif - for(int x = task.displace_x; x < task.displace_x + task.displace_w; x++) { - kernel_cpu_displace(kg, (uint4*)task.displace_input, (float3*)task.displace_offset, x); +#ifdef WITH_OPTIMIZED_KERNEL + if(system_cpu_support_optimized()) { + for(int x = task.displace_x; x < task.displace_x + task.displace_w; x++) { + kernel_cpu_optimized_displace(kg, (uint4*)task.displace_input, (float3*)task.displace_offset, x); - if(tasks.worker_cancel()) - break; + if(tasks.worker_cancel()) + break; + } + } + else +#endif + { + for(int x = task.displace_x; x < task.displace_x + task.displace_w; x++) { + kernel_cpu_displace(kg, (uint4*)task.displace_input, (float3*)task.displace_offset, x); + + if(tasks.worker_cancel()) + break; + } } #ifdef WITH_OSL diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 2bfb6c58120..73425486be1 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -8,6 +8,7 @@ set(INC set(SRC kernel.cpp + kernel_optimized.cpp kernel.cl kernel.cu ) @@ -123,11 +124,15 @@ include_directories(${INC}) add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS}) +if(WITH_CYCLES_OPTIMIZED_KERNEL) + SET_SOURCE_FILES_PROPERTIES(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS ${CYCLES_OPTIMIZED_KERNEL_FLAGS}) +endif() + if(WITH_CYCLES_CUDA) add_dependencies(cycles_kernel cycles_kernel_cuda) endif() -# OPENCL kernel +# OpenCL kernel #set(KERNEL_PREPROCESSED ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl) #add_custom_command( @@ -142,3 +147,4 @@ delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/k delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel) delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm) delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel) + diff --git a/intern/cycles/kernel/kernel.h b/intern/cycles/kernel/kernel.h index 7f60730e8bf..700ee49c5f2 100644 --- a/intern/cycles/kernel/kernel.h +++ b/intern/cycles/kernel/kernel.h @@ -38,9 +38,14 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t void kernel_cpu_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y); void kernel_cpu_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y); - void kernel_cpu_displace(KernelGlobals *kg, uint4 *input, float3 *offset, int i); +#ifdef WITH_OPTIMIZED_KERNEL +void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y); +void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y); +void kernel_cpu_optimized_displace(KernelGlobals *kg, uint4 *input, float3 *offset, int i); +#endif + CCL_NAMESPACE_END #endif /* __KERNEL_H__ */ diff --git a/intern/cycles/kernel/kernel_optimized.cpp b/intern/cycles/kernel/kernel_optimized.cpp new file mode 100644 index 00000000000..85a2b798a62 --- /dev/null +++ b/intern/cycles/kernel/kernel_optimized.cpp @@ -0,0 +1,60 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Optimized CPU kernel entry points. This file is compiled with SSE3 + optimization flags and nearly all functions inlined, while kernel.cpp + is compiled without for other CPU's. */ + +#ifdef WITH_OPTIMIZED_KERNEL + +#include "kernel.h" +#include "kernel_compat_cpu.h" +#include "kernel_math.h" +#include "kernel_types.h" +#include "kernel_globals.h" +#include "kernel_film.h" +#include "kernel_path.h" +#include "kernel_displace.h" + +CCL_NAMESPACE_BEGIN + +/* Path Tracing */ + +void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y) +{ + kernel_path_trace(kg, buffer, rng_state, sample, x, y); +} + +/* Tonemapping */ + +void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y) +{ + kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y); +} + +/* Displacement */ + +void kernel_cpu_optimized_displace(KernelGlobals *kg, uint4 *input, float3 *offset, int i) +{ + kernel_displace(kg, input, offset, i); +} + +CCL_NAMESPACE_END + +#endif + diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 8b09f227a74..abf5e08de97 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -118,5 +118,78 @@ int system_cpu_bits() return (sizeof(void*)*8); } +#if defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(_M_IX86) + +struct CPUCapabilities { + bool x64; + bool mmx; + bool sse; + bool sse2; + bool sse3; + bool ssse3; + bool sse41; + bool sse42; + bool sse4a; + bool avx; + bool xop; + bool fma3; + bool fma4; +}; + +bool system_cpu_support_optimized() +{ + static CPUCapabilities caps; + static bool caps_init = false; + + if(!caps_init) { + int result[4], num, num_ex; + + memset(&caps, 0, sizeof(caps)); + + __cpuid(result, 0); + num = result[0]; + + __cpuid(result, 0x80000000); + num_ex = result[0]; + + if(num >= 1){ + __cpuid(result, 0x00000001); + caps.mmx = (result[3] & ((int)1 << 23)) != 0; + caps.sse = (result[3] & ((int)1 << 25)) != 0; + caps.sse2 = (result[3] & ((int)1 << 26)) != 0; + caps.sse3 = (result[2] & ((int)1 << 0)) != 0; + + caps.ssse3 = (result[2] & ((int)1 << 9)) != 0; + caps.sse41 = (result[2] & ((int)1 << 19)) != 0; + caps.sse42 = (result[2] & ((int)1 << 20)) != 0; + + caps.avx = (result[2] & ((int)1 << 28)) != 0; + caps.fma3 = (result[2] & ((int)1 << 12)) != 0; + } + + /*if(num_ex >= 0x80000001){ + __cpuid(result, 0x80000001); + caps.x64 = (result[3] & ((int)1 << 29)) != 0; + caps.sse4a = (result[2] & ((int)1 << 6)) != 0; + caps.fma4 = (result[2] & ((int)1 << 16)) != 0; + caps.xop = (result[2] & ((int)1 << 11)) != 0; + }*/ + + caps_init = true; + } + + /* optimization flags use these */ + return caps.sse && caps.sse2 && caps.sse3; +} + +#else + +bool system_cpu_support_optimized() +{ + return false; +} + +#endif + CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h index 214b3a18ca3..f25e009a250 100644 --- a/intern/cycles/util/util_system.h +++ b/intern/cycles/util/util_system.h @@ -26,6 +26,7 @@ CCL_NAMESPACE_BEGIN int system_cpu_thread_count(); string system_cpu_brand_string(); int system_cpu_bits(); +bool system_cpu_support_optimized(); CCL_NAMESPACE_END From f403d9a2b1128565c503755668c7bc001ecb2eb3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 15:24:57 +0000 Subject: [PATCH 100/203] replace rna description string limits with rna define RNA_DYN_DESCR_MAX --- source/blender/makesrna/RNA_define.h | 3 +++ source/blender/makesrna/intern/rna_ui.c | 6 +++--- source/blender/makesrna/intern/rna_wm.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 6dc7bf2abe3..b7ac5f394b0 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -208,6 +208,9 @@ const char *RNA_property_typename(PropertyType type); #define IS_DNATYPE_FLOAT_COMPAT(_str) (strcmp(_str, "float") == 0 || strcmp(_str, "double") == 0) #define IS_DNATYPE_INT_COMPAT(_str) (strcmp(_str, "int") == 0 || strcmp(_str, "short") == 0 || strcmp(_str, "char") == 0) +/* max size for dynamic defined type descriptors, + * this value is arbitrary */ +#define RNA_DYN_DESCR_MAX 240 #ifdef __cplusplus } diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 1ad9cb00ba1..be0fec41aa1 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -413,7 +413,7 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type) WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } -static char _menu_descr[1024]; +static char _menu_descr[RNA_DYN_DESCR_MAX]; static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { @@ -490,7 +490,7 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) { Menu *data= (Menu*)(ptr->data); char *str= (char *)data->type->description; - if(!str[0]) strcpy(str, value); + if(!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ else assert(!"setting the bl_description on a non-builtin menu"); } @@ -830,7 +830,7 @@ static void rna_def_menu(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->description"); - RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7e55c832f3f..8e05e43b48f 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -966,7 +966,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata); static char _operator_idname[OP_MAX_TYPENAME]; static char _operator_name[OP_MAX_TYPENAME]; -static char _operator_descr[1024]; +static char _operator_descr[RNA_DYN_DESCR_MAX]; static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { wmOperatorType dummyot = {NULL}; @@ -1161,7 +1161,7 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value) { wmOperator *data= (wmOperator*)(ptr->data); char *str= (char *)data->type->idname; - if(!str[0]) strcpy(str, value); + if(!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ else assert(!"setting the bl_idname on a non-builtin operator"); } @@ -1169,7 +1169,7 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) { wmOperator *data= (wmOperator*)(ptr->data); char *str= (char *)data->type->name; - if(!str[0]) strcpy(str, value); + if(!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ else assert(!"setting the bl_label on a non-builtin operator"); } @@ -1177,7 +1177,7 @@ static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) { wmOperator *data= (wmOperator*)(ptr->data); char *str= (char *)data->type->description; - if(!str[0]) strcpy(str, value); + if(!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ else assert(!"setting the bl_description on a non-builtin operator"); } @@ -1232,14 +1232,14 @@ static void rna_def_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); - RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->description"); - RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); @@ -1293,14 +1293,14 @@ static void rna_def_macro_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->name"); - RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->description"); - RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); From 0c7a25cd0ec8e1aaa853de6f5ec67e030917e15a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Nov 2011 16:38:48 +0000 Subject: [PATCH 101/203] patch [#28993] wm_window_match_do(): Fix crash on null pointer dereference from Ola Jeppsson (olajep) also some cleanup edits --- source/blender/blenkernel/intern/softbody.c | 2 +- source/blender/editors/transform/transform.c | 8 +-- .../editors/transform/transform_snap.c | 52 +++++++++---------- source/blender/makesrna/intern/rna_text.c | 2 +- .../blender/windowmanager/intern/wm_apple.c | 4 +- .../blender/windowmanager/intern/wm_files.c | 11 ++-- 6 files changed, 41 insertions(+), 38 deletions(-) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index d3d6a658ede..cab621eeff7 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2368,7 +2368,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo /* ---springs */ }/*omit on snap */ }/*loop all bp's*/ -return 0; /*done fine*/ + return 0; /*done fine*/ } static void *exec_softbody_calc_forces(void *data) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5060f55c533..73a71a25eba 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -93,8 +93,8 @@ #include "transform.h" -void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg); -int doEdgeSlide(TransInfo *t, float perc); +static void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg); +static int doEdgeSlide(TransInfo *t, float perc); /* ************************** SPACE DEPENDANT CODE **************************** */ @@ -1784,7 +1784,7 @@ void transformApply(bContext *C, TransInfo *t) t->context = NULL; } -void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg) +static void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -4840,7 +4840,7 @@ void initEdgeSlide(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int doEdgeSlide(TransInfo *t, float perc) +static int doEdgeSlide(TransInfo *t, float perc) { SlideData *sld = t->customData; EditVert *ev, *nearest = sld->nearest; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index fa19d12d5ad..6e81200016d 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -90,23 +90,23 @@ /********************* PROTOTYPES ***********************/ -void setSnappingCallback(TransInfo *t); +static void setSnappingCallback(TransInfo *t); -void ApplySnapTranslation(TransInfo *t, float vec[3]); -void ApplySnapRotation(TransInfo *t, float *vec); -void ApplySnapResize(TransInfo *t, float *vec); +static void ApplySnapTranslation(TransInfo *t, float vec[3]); +static void ApplySnapRotation(TransInfo *t, float *vec); +static void ApplySnapResize(TransInfo *t, float *vec); -void CalcSnapGrid(TransInfo *t, float *vec); -void CalcSnapGeometry(TransInfo *t, float *vec); +static void CalcSnapGrid(TransInfo *t, float *vec); +static void CalcSnapGeometry(TransInfo *t, float *vec); -void TargetSnapMedian(TransInfo *t); -void TargetSnapCenter(TransInfo *t); -void TargetSnapClosest(TransInfo *t); -void TargetSnapActive(TransInfo *t); +static void TargetSnapMedian(TransInfo *t); +static void TargetSnapCenter(TransInfo *t); +static void TargetSnapClosest(TransInfo *t); +static void TargetSnapActive(TransInfo *t); -float RotationBetween(TransInfo *t, float p1[3], float p2[3]); -float TranslationBetween(TransInfo *t, float p1[3], float p2[3]); -float ResizeBetween(TransInfo *t, float p1[3], float p2[3]); +static float RotationBetween(TransInfo *t, float p1[3], float p2[3]); +static float TranslationBetween(TransInfo *t, float p1[3], float p2[3]); +static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]); /****************** IMPLEMENTATIONS *********************/ @@ -483,7 +483,7 @@ void initSnapping(TransInfo *t, wmOperator *op) initSnappingMode(t); } -void setSnappingCallback(TransInfo *t) +static void setSnappingCallback(TransInfo *t) { t->tsnap.calcSnap = CalcSnapGeometry; @@ -584,14 +584,14 @@ void getSnapPoint(TransInfo *t, float vec[3]) /********************** APPLY **************************/ -void ApplySnapTranslation(TransInfo *t, float vec[3]) +static void ApplySnapTranslation(TransInfo *t, float vec[3]) { float point[3]; getSnapPoint(t, point); sub_v3_v3v3(vec, point, t->tsnap.snapTarget); } -void ApplySnapRotation(TransInfo *t, float *vec) +static void ApplySnapRotation(TransInfo *t, float *vec) { if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) { *vec = t->tsnap.dist; @@ -603,7 +603,7 @@ void ApplySnapRotation(TransInfo *t, float *vec) } } -void ApplySnapResize(TransInfo *t, float vec[3]) +static void ApplySnapResize(TransInfo *t, float vec[3]) { if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) { vec[0] = vec[1] = vec[2] = t->tsnap.dist; @@ -617,12 +617,12 @@ void ApplySnapResize(TransInfo *t, float vec[3]) /********************** DISTANCE **************************/ -float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) +static float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) { return len_v3v3(p1, p2); } -float RotationBetween(TransInfo *t, float p1[3], float p2[3]) +static float RotationBetween(TransInfo *t, float p1[3], float p2[3]) { float angle, start[3], end[3], center[3]; @@ -678,7 +678,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) return angle; } -float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) +static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) { float d1[3], d2[3], center[3]; @@ -701,12 +701,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) +static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } -void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) +static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { if (t->spacetype == SPACE_VIEW3D) { @@ -866,7 +866,7 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) /********************** TARGET **************************/ -void TargetSnapCenter(TransInfo *t) +static void TargetSnapCenter(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -881,7 +881,7 @@ void TargetSnapCenter(TransInfo *t) } } -void TargetSnapActive(TransInfo *t) +static void TargetSnapActive(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -920,7 +920,7 @@ void TargetSnapActive(TransInfo *t) } } -void TargetSnapMedian(TransInfo *t) +static void TargetSnapMedian(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -948,7 +948,7 @@ void TargetSnapMedian(TransInfo *t) } } -void TargetSnapClosest(TransInfo *t) +static void TargetSnapClosest(TransInfo *t) { // Only valid if a snap point has been selected if (t->tsnap.status & POINT_INIT) diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index a0d0bc088f7..9e3611b4cc5 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -42,7 +42,7 @@ #ifdef RNA_RUNTIME -int text_file_modified(Text *text); +int text_file_modified(Text *text); /* XXX bad level call */ static void rna_Text_filename_get(PointerRNA *ptr, char *value) { diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c index c19523cbaee..e17441873d5 100644 --- a/source/blender/windowmanager/intern/wm_apple.c +++ b/source/blender/windowmanager/intern/wm_apple.c @@ -98,8 +98,8 @@ static int checkAppleVideoCard(void) StandardAlert ( kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit); abort(); } -CGLDestroyRendererInfo (rend); -return 0; + CGLDestroyRendererInfo (rend); + return 0; } static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 8d7e812a386..1a7031c7d31 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -155,8 +155,9 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) CTX_wm_window_set(C, active_win); ED_editors_exit(C); - -return; + + /* just had return; here from r12991, this code could just get removed?*/ +#if 0 if(wm==NULL) return; if(G.fileflags & G_FILE_NO_UI) return; @@ -168,6 +169,7 @@ return; //BLI_addtail(screenbase, win->screen); } } +#endif } /* match old WM with new, 4 cases: @@ -193,9 +195,10 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) /* we've read file without wm..., keep current one entirely alive */ if(G.main->wm.first==NULL) { + bScreen *screen= NULL; + /* when loading without UI, no matching needed */ - if(!(G.fileflags & G_FILE_NO_UI)) { - bScreen *screen= CTX_wm_screen(C); + if(!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) { /* match oldwm to new dbase, only old files */ for(wm= oldwmlist->first; wm; wm= wm->id.next) { From e78cad55403a7990db4ba17956bb8d64e0bd878f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 18:01:52 +0000 Subject: [PATCH 102/203] Fix build issue on windows, M_PI => M_PI_F. --- intern/cycles/kernel/svm/bsdf_oren_nayar.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/cycles/kernel/svm/bsdf_oren_nayar.h b/intern/cycles/kernel/svm/bsdf_oren_nayar.h index 9eefdffe6ae..11dc07e485c 100644 --- a/intern/cycles/kernel/svm/bsdf_oren_nayar.h +++ b/intern/cycles/kernel/svm/bsdf_oren_nayar.h @@ -84,8 +84,8 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig sigma = clamp(sigma, 0.0f, 1.0f); - sc->data0 = 1.0f / ((1.0f + 0.5f * sigma) * M_PI); - sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI); + sc->data0 = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F); + sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI_F); } __device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness) From c7ec8a2e54b7557a5f0f96a35c1c05402dee95b9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 18:24:17 +0000 Subject: [PATCH 103/203] Fix for #29165 bugfix: adding nodes from shift+A menu in node editor did nothing. --- source/blender/editors/interface/interface_layout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 2529dca5a63..c553c1e35ad 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1492,11 +1492,11 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) w= ui_text_icon_width(layout, name, icon, 0); if(icon && name[0]) - uiDefIconTextButF(block, BUT, 0, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefIconTextButF(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, ""); else if(icon) - uiDefIconButF(block, BUT, 0, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefIconButF(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, ""); else - uiDefButF(block, BUT, 0, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, ""); + uiDefButF(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, ""); } /* separator item */ @@ -2517,7 +2517,7 @@ static void ui_item_layout(uiItem *item) static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y) { if(layout->root->handlefunc) - uiBlockSetButmFunc(block, layout->root->handlefunc, layout->root->argv); + uiBlockSetHandleFunc(block, layout->root->handlefunc, layout->root->argv); ui_item_estimate(&layout->item); ui_item_layout(&layout->item); From ef6eab3ce4519a07041d7321b7c5775b1d1870f3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 19:23:35 +0000 Subject: [PATCH 104/203] Cycles: move clew into cycles namespace to avoid conflicts, and fix mesh displacement panel showing with blender internal. --- intern/cycles/SConscript | 2 +- intern/cycles/blender/addon/ui.py | 2 +- intern/cycles/util/CMakeLists.txt | 2 +- .../util/{util_opencl.c => util_opencl.cpp} | 6 +++++- intern/cycles/util/util_opencl.h | 15 +++------------ 5 files changed, 11 insertions(+), 16 deletions(-) rename intern/cycles/util/{util_opencl.c => util_opencl.cpp} (99%) diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 1acb7321f09..4d45a6875a9 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -6,7 +6,7 @@ cycles = env.Clone() cycles.Depends('../../source/blender/makesrna/intern/RNA_blender_cpp.h', 'makesrna') -sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('kernel/*.cpp') + cycles.Glob('render/*.cpp') + cycles.Glob('subd/*.cpp') + cycles.Glob('util/*.cpp') + cycles.Glob('util/*.c') + cycles.Glob('blender/*.cpp') +sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('kernel/*.cpp') + cycles.Glob('render/*.cpp') + cycles.Glob('subd/*.cpp') + cycles.Glob('util/*.cpp') + cycles.Glob('blender/*.cpp') sources.remove(path.join('util', 'util_view.cpp')) sources.remove(path.join('render', 'film_response.cpp')) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 6cebe3d24e4..d96efe93cf8 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -295,7 +295,7 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.mesh or context.curve or context.meta_ball + return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball def draw(self, context): layout = self.layout diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 76e948504eb..9182ee4cbe1 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -11,7 +11,7 @@ set(SRC util_dynlib.cpp util_md5.cpp util_memarena.cpp - util_opencl.c + util_opencl.cpp util_path.cpp util_string.cpp util_system.cpp diff --git a/intern/cycles/util/util_opencl.c b/intern/cycles/util/util_opencl.cpp similarity index 99% rename from intern/cycles/util/util_opencl.c rename to intern/cycles/util/util_opencl.cpp index 10429ffcd80..1d05b0b687a 100755 --- a/intern/cycles/util/util_opencl.c +++ b/intern/cycles/util/util_opencl.cpp @@ -7,6 +7,8 @@ // Extracted from the CLCC project - http://clcc.sourceforge.net/ ////////////////////////////////////////////////////////////////////////// +#include + #include "util_opencl.h" #ifndef CLCC_GENERATE_DOCUMENTATION @@ -36,7 +38,7 @@ //#define CLCC_DYNLIB_IMPORT implementation_defined #endif -#include +CCL_NAMESPACE_BEGIN //! \brief module handle static CLCC_DYNLIB_HANDLE module = NULL; @@ -315,3 +317,5 @@ const char *clErrorString(cl_int error) return strings[-error]; } +CCL_NAMESPACE_END + diff --git a/intern/cycles/util/util_opencl.h b/intern/cycles/util/util_opencl.h index 08694874ac1..2e97097ef36 100755 --- a/intern/cycles/util/util_opencl.h +++ b/intern/cycles/util/util_opencl.h @@ -10,6 +10,8 @@ #ifndef __UTIL_OPENCL_H__ #define __UTIL_OPENCL_H__ +CCL_NAMESPACE_BEGIN + //! This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the //! official OpenCL spec. The purpose of this code is to load the OpenCL dynamic //! library at run-time and thus allow the executable to function on many @@ -56,15 +58,6 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ -#ifdef __APPLE__ -/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */ -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - #ifndef CLCC_GENERATE_DOCUMENTATION #if defined(_WIN32) @@ -1312,9 +1305,7 @@ CLEW_FUN_EXPORT PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFuncti int clLibraryInit(void); const char *clErrorString(cl_int error); -#ifdef __cplusplus -} -#endif +CCL_NAMESPACE_END #endif /* __UTIL_OPENCL_H__ */ From 677c67c2cf7ef94d46c467cda6f63a07ca6e4474 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 19:25:28 +0000 Subject: [PATCH 105/203] Fix #29275: vertex/edge/face selection buttons showing squashed in 3d view header. --- release/scripts/startup/bl_ui/space_view3d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 2bfbd15cf55..536936105e3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -55,8 +55,8 @@ class VIEW3D_HT_header(Header): sub.menu("VIEW3D_MT_object") # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode... - row = layout.row() # XXX Narrowed down vert/edge/face selector in edit mode/solid drawmode. -DingTo - row.template_header_3D() + row = layout + layout.template_header_3D() if obj: # Particle edit From 4f743dd0cc9e2a229402f08905c01ec248a038bf Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Tue, 15 Nov 2011 19:37:09 +0000 Subject: [PATCH 106/203] SVN maintenance. --- extern/libmv/third_party/ssba/README.libmv | 0 intern/cycles/util/util_opencl.cpp | 0 intern/cycles/util/util_opencl.h | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 extern/libmv/third_party/ssba/README.libmv mode change 100755 => 100644 intern/cycles/util/util_opencl.cpp mode change 100755 => 100644 intern/cycles/util/util_opencl.h diff --git a/extern/libmv/third_party/ssba/README.libmv b/extern/libmv/third_party/ssba/README.libmv old mode 100755 new mode 100644 diff --git a/intern/cycles/util/util_opencl.cpp b/intern/cycles/util/util_opencl.cpp old mode 100755 new mode 100644 diff --git a/intern/cycles/util/util_opencl.h b/intern/cycles/util/util_opencl.h old mode 100755 new mode 100644 From 4c12550fe89a6a14ae246c37a97626c1b55c2b19 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 19:46:56 +0000 Subject: [PATCH 107/203] Fix #29208: Text.clear() and Text.write() did not redraw text editor. --- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_text_api.c | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a464948c3ac..6dbf7b9c553 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2481,7 +2481,7 @@ static RNAProcessItem PROCESS_ITEMS[]= { {"rna_space.c", NULL, RNA_def_space}, {"rna_speaker.c", NULL, RNA_def_speaker}, {"rna_test.c", NULL, RNA_def_test}, - {"rna_text.c", NULL, RNA_def_text}, + {"rna_text.c", "rna_text_api.c", RNA_def_text}, {"rna_timeline.c", NULL, RNA_def_timeline_marker}, {"rna_sound.c", NULL, RNA_def_sound}, {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index ec669b28918..acfcad80f19 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -28,11 +28,25 @@ #include #include - #include "RNA_define.h" #ifdef RNA_RUNTIME +#include "WM_api.h" +#include "WM_types.h" + +static void rna_Text_clear(Text *text) +{ + clear_text(text); + WM_main_add_notifier(NC_TEXT|NA_EDITED, text); +} + +static void rna_Text_write(Text *text, const char *str) +{ + write_text(text, str); + WM_main_add_notifier(NC_TEXT|NA_EDITED, text); +} + #else void RNA_api_text(StructRNA *srna) @@ -40,10 +54,10 @@ void RNA_api_text(StructRNA *srna) FunctionRNA *func; PropertyRNA *prop; - func= RNA_def_function(srna, "clear", "clear_text"); + func= RNA_def_function(srna, "clear", "rna_Text_clear"); RNA_def_function_ui_description(func, "clear the text block"); - func= RNA_def_function(srna, "write", "write_text"); + func= RNA_def_function(srna, "write", "rna_Text_write"); RNA_def_function_ui_description(func, "write text at the cursor location and advance to the end of the text block"); prop= RNA_def_string(func, "text", "Text", 0, "", "New text for this datablock"); RNA_def_property_flag(prop, PROP_REQUIRED); From e8502b7f5fb4797490619c57c6542d8c921c3e2c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 20:02:45 +0000 Subject: [PATCH 108/203] Typo fixes in descriptions. --- source/blender/editors/space_clip/tracking_ops.c | 2 +- source/blender/makesrna/intern/rna_movieclip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index a93ad9724c5..7791e9f3e57 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1653,7 +1653,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot) /* identifiers */ ot->name= "Clear Track Path"; - ot->description= "Clear tracks after/before current position or cleat the whole track"; + ot->description= "Clear tracks after/before current position or clear the whole track"; ot->idname= "CLIP_OT_clear_track_path"; /* api callbacks */ diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index acb70e9fde2..3b1ac8f22c3 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -121,7 +121,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) /* quality of proxied image */ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "quality"); - RNA_def_property_ui_text(prop, "Quality", "JPEG of proxy images"); + RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images"); RNA_def_property_ui_range(prop, 1, 100, 1, 0); prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); From 4cc8677f1cc6d7524bc67c333b240ff98df9649c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 20:19:15 +0000 Subject: [PATCH 109/203] Fix: part of 3d view header disappears when collapsing menus. --- source/blender/editors/space_view3d/view3d_header.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 6eafb10d74c..b9513ab0880 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -490,10 +490,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) else v3d->modeselect = OB_MODE_OBJECT; - uiBlockBeginAlign(block); + row= uiLayoutRow(layout, 1); uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode")); - uiBlockEndAlign(block); /* Draw type */ uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); From 541b19c70123b115f2859033c6ac5e47a9913cdf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Nov 2011 20:26:44 +0000 Subject: [PATCH 110/203] Fix issue with tracks color presets --- release/scripts/startup/bl_operators/presets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index dca96b302fb..100b21fc303 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -349,7 +349,7 @@ class AddPresetTrackingTrackColor(AddPresetBase, Operator): preset_menu = "CLIP_MT_track_color_presets" preset_defines = [ - "track = bpy.context.edit_movieclip.tracking.tracks" + "track = bpy.context.edit_movieclip.tracking.tracks.active" ] preset_values = [ From 8db117a81a00bbd697e4d1a7b7039e67f4c47af6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 21:16:37 +0000 Subject: [PATCH 111/203] Fix #28936: UV unwrap issue with meshes with inconsistent normals. --- source/blender/editors/uvedit/uvedit_parametrizer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 1b117a15516..7ad573231c9 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -546,17 +546,21 @@ static void p_face_flip(PFace *f) PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert; int f1 = e1->flag, f2 = e2->flag, f3 = e3->flag; + float *orig_uv1 = e1->orig_uv, *orig_uv2 = e2->orig_uv, *orig_uv3 = e3->orig_uv; e1->vert = v2; e1->next = e3; + e1->orig_uv = orig_uv2; e1->flag = (f1 & ~PEDGE_VERTEX_FLAGS) | (f2 & PEDGE_VERTEX_FLAGS); e2->vert = v3; e2->next = e1; + e2->orig_uv = orig_uv3; e2->flag = (f2 & ~PEDGE_VERTEX_FLAGS) | (f3 & PEDGE_VERTEX_FLAGS); e3->vert = v1; e3->next = e2; + e3->orig_uv = orig_uv1; e3->flag = (f3 & ~PEDGE_VERTEX_FLAGS) | (f1 & PEDGE_VERTEX_FLAGS); } From bff59a5b2eb9f8fd50df6250f020b46ff71bcdba Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Tue, 15 Nov 2011 21:55:07 +0000 Subject: [PATCH 112/203] OSX: buildfix for itask on 10.5.sdk --- intern/itasc/kdl/chain.hpp | 4 ++++ intern/itasc/kdl/tree.hpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/intern/itasc/kdl/chain.hpp b/intern/itasc/kdl/chain.hpp index 81c606b73c0..773f472cc5c 100644 --- a/intern/itasc/kdl/chain.hpp +++ b/intern/itasc/kdl/chain.hpp @@ -35,8 +35,12 @@ namespace KDL { */ class Chain { private: +#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5) // Eigen allocator is needed for alignment of Eigen data types std::vector > segments; +#else + std::vector segments; +#endif unsigned int nrOfJoints; unsigned int nrOfSegments; public: diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp index 6b822dcd1e0..4dfb55c7823 100644 --- a/intern/itasc/kdl/tree.hpp +++ b/intern/itasc/kdl/tree.hpp @@ -27,15 +27,20 @@ #include #include +#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5) #include +#endif namespace KDL { //Forward declaration class TreeElement; +#if !defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_5) // Eigen allocator is needed for alignment of Eigen data types typedef std::map, Eigen::aligned_allocator > > SegmentMap; - +#else + typedef std::map SegmentMap; +#endif class TreeElement { private: From 63ff37c6d4b081f06c4319326057df3104213504 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 22:09:30 +0000 Subject: [PATCH 113/203] Fix #29278: cycles crash with displacement method both. --- intern/cycles/kernel/kernel_shader.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index ac0df71c38f..1647504207a 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -226,8 +226,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd, Ng = triangle_normal_MT(kg, prim, &shader); /* force smooth shading for displacement */ - if(shader >= 0) - shader = -shader; + sd->shader |= SHADER_SMOOTH_NORMAL; /* watch out: no instance transform currently */ From 0792ab3652ce31377f9a994430cd62cd849d6684 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 23:03:35 +0000 Subject: [PATCH 114/203] Fix #29232: on background render where it could not find the .blend file, the default cube would be rendered instead, now stops processing arguments after failed file load. --- source/creator/creator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/creator/creator.c b/source/creator/creator.c index 1f6f4d85f43..38f9527e64b 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -437,7 +437,7 @@ static int prefsize(int argc, const char **argv, void *UNUSED(data)) int stax, stay, sizx, sizy; if (argc < 5) { - printf ("-p requires four arguments\n"); + fprintf (stderr, "-p requires four arguments\n"); exit(1); } @@ -515,7 +515,7 @@ static int no_audio(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(da static int set_audio(int argc, const char **argv, void *UNUSED(data)) { if (argc < 1) { - printf("-setaudio require one argument\n"); + fprintf(stderr, "-setaudio require one argument\n"); exit(1); } @@ -977,6 +977,10 @@ static int load_file(int UNUSED(argc), const char **argv, void *data) DAG_on_visible_update(CTX_data_main(C), TRUE); } + else { + /* failed to load file, stop processing arguments */ + return -1; + } /* WM_read_file() runs normally but since we're in background mode do here */ #ifdef WITH_PYTHON From 9f46ca46a6fcdacf53d95a61147272352154204b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 16 Nov 2011 00:13:38 +0000 Subject: [PATCH 115/203] Partial Bugfix: [#29229] Outliner RMB commands unexpected results This commit implements the Unlink and Make Single User capabilities for World datablocks in the Outliner --- .../editors/space_outliner/outliner_tools.c | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index a4f67f91763..a7f7e36b182 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -236,6 +236,16 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme } } +static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem) +{ + Scene *parscene = (Scene *)tsep->id; + World *wo = (World *)tselem->id; + + /* need to use parent scene not just scene, otherwise may end up getting wrong one */ + id_us_min(&wo->id); + parscene->world = NULL; +} + static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *)) { @@ -350,6 +360,23 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement } } +static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem) +{ + ID *id = tselem->id; + + /* need to use parent scene not just scene, otherwise may end up getting wrong one */ + if (id) { + Scene *parscene = (Scene *)tsep->id; + PointerRNA ptr = {{NULL}}; + PropertyRNA *prop; + + RNA_id_pointer_create(&parscene->id, &ptr); + prop = RNA_struct_find_property(&ptr, "world"); + + id_single_user(C, id, &ptr, prop); + } +} + static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; @@ -746,6 +773,12 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL); ED_undo_push(C, "Unlink texture"); break; + case ID_WO: + outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb); + + WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL); + ED_undo_push(C, "Unlink world"); + break; default: BKE_report(op->reports, RPT_WARNING, "Not Yet"); break; @@ -772,6 +805,13 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Single-User Action"); break; + case ID_WO: + outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb); + + WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL); + ED_undo_push(C, "Single-User World"); + break; + default: BKE_report(op->reports, RPT_WARNING, "Not Yet"); break; @@ -799,12 +839,13 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) } break; case OUTLINER_IDOP_RENAME: + { /* rename */ outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); - + WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL); ED_undo_push(C, "Rename"); - + } break; default: From 683e6faf81d763b75dee3237a03ecda0705a18ba Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 16 Nov 2011 02:14:39 +0000 Subject: [PATCH 116/203] Partial Bugfix 2: [#29229] Outliner RMB commands unexpected results RenderLayers and RenderPasses don't show the generic Hide/Unhide/Select/Deselect popup which is irrelevant for this use case. I've included a commented-out call here that can be replaced when we have some operations which can be performed on this data (*) (*) For new devs looking to get into blender dev, this could be a nice little project to work on. --- source/blender/editors/space_outliner/outliner_tools.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index a7f7e36b182..27ad2c4fd6d 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -1218,6 +1218,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL); else if (datalevel == TSE_DRIVER_BASE) /* do nothing... no special ops needed yet */; + else if ELEM3(datalevel, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS) + /*WM_operator_name_call(C, "OUTLINER_OT_renderdata_operation", WM_OP_INVOKE_REGION_WIN, NULL)*/; else WM_operator_name_call(C, "OUTLINER_OT_data_operation", WM_OP_INVOKE_REGION_WIN, NULL); } From 9d31c99c26956ecedf0bdcf9e02ce412d313257b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 03:44:08 +0000 Subject: [PATCH 117/203] support for creating project files in utf8 paths (was defaulting to ascii and throwing errors) --- build_files/cmake/cmake_qtcreator_project.py | 6 +++--- build_files/cmake/project_info.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index a89bcd01523..07ffa659437 100755 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -89,7 +89,7 @@ def create_qtc_project_main(): f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) - f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') + f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) @@ -104,7 +104,7 @@ def create_qtc_project_main(): defines_final += cmake_compiler_defines() f.write("\n".join(defines_final)) - print("Blender project file written to: %s" % qtc_prj) + print("Blender project file written to: %r" % qtc_prj) # --- end @@ -133,7 +133,7 @@ def create_qtc_project_python(): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") - print("Python project file written to: %s" % qtc_prj) + print("Python project file written to: %r" % qtc_prj) def main(): diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index eed002ce7ba..0b922979a63 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -186,7 +186,7 @@ def cmake_advanced_info(): def cmake_cache_var(var): - cache_file = open(join(CMAKE_DIR, "CMakeCache.txt")) + cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8') lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")] cache_file.close() From ba7fbf6ae73ff488300b1e22d440cba0b0bd89cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 03:56:34 +0000 Subject: [PATCH 118/203] formatting edits & doc correction, no functional changes. --- .../python/mathutils/mathutils_Color.c | 8 +- .../python/mathutils/mathutils_Matrix.c | 21 +- .../python/mathutils/mathutils_Quaternion.c | 3 +- .../python/mathutils/mathutils_Vector.c | 236 +++++++++--------- .../python/mathutils/mathutils_geometry.c | 2 - 5 files changed, 138 insertions(+), 132 deletions(-) diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 3e7aeef3044..79628cf5ae9 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -834,18 +834,18 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type) self= base_type ? (ColorObject *)base_type->tp_alloc(base_type, 0) : (ColorObject *)PyObject_GC_New(ColorObject, &color_Type); - if(self) { + if (self) { /* init callbacks as NULL */ self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP) { + if (type == Py_WRAP) { self->col = col; self->wrapped = Py_WRAP; } else if (type == Py_NEW) { self->col = PyMem_Malloc(COLOR_SIZE * sizeof(float)); - if(col) + if (col) copy_v3_v3(self->col, col); else zero_v3(self->col); @@ -863,7 +863,7 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type) PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) { ColorObject *self= (ColorObject *)newColorObject(NULL, Py_NEW, NULL); - if(self) { + if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 293a960e0a6..1472b6886f6 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -941,8 +941,10 @@ static PyObject *Matrix_invert(MatrixObject *self) int x, y, z = 0; float det = 0.0f; - float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f}; if (BaseMath_ReadCallback(self) == -1) return NULL; @@ -964,9 +966,11 @@ static PyObject *Matrix_invert(MatrixObject *self) mat[1] = -self->matrix[0][1]; mat[2] = -self->matrix[1][0]; mat[3] = self->matrix[0][0]; - } else if (self->row_size == 3) { + } + else if (self->row_size == 3) { adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr); - } else if (self->row_size == 4) { + } + else if (self->row_size == 4) { adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr); } /*divide by determinate*/ @@ -1183,7 +1187,8 @@ static PyObject *Matrix_transpose(MatrixObject *self) t = self->matrix[1][0]; self->matrix[1][0] = self->matrix[0][1]; self->matrix[0][1] = t; - } else if (self->row_size == 3) { + } + else if (self->row_size == 3) { transpose_m3((float (*)[3])self->contigPtr); } else { @@ -1253,7 +1258,8 @@ static PyObject *Matrix_identity(MatrixObject *self) self->matrix[0][1] = 0.0f; self->matrix[1][0] = 0.0f; self->matrix[1][1] = 1.0f; - } else if (self->row_size == 3) { + } + else if (self->row_size == 3) { unit_m3((float (*)[3])self->contigPtr); } else { @@ -1657,7 +1663,8 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) if (i < 0) i += self->row_size; return Matrix_item(self, i); - } else if (PySlice_Check(item)) { + } + else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0) diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index a8585f386d5..8a6c4909e94 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -639,7 +639,8 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item) if (i < 0) i += QUAT_SIZE; return Quaternion_item(self, i); - } else if (PySlice_Check(item)) { + } + else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0) diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 66dda6a9623..f70bd42e2b6 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -61,7 +61,7 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED case 0: break; case 1: - if((size=mathutils_array_parse(vec, 2, 4, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) + if ((size=mathutils_array_parse(vec, 2, 4, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) return NULL; break; default: @@ -77,7 +77,7 @@ static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *sel { PyObject *ret= Vector_copy(self); PyObject *ret_dummy= vec_func(ret); - if(ret_dummy) { + if (ret_dummy) { Py_DECREF(ret_dummy); return (PyObject *)ret; } @@ -97,7 +97,7 @@ static PyObject *Vector_zero(VectorObject *self) { fill_vn(self->vec, self->size, 0.0f); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return NULL; Py_RETURN_NONE; @@ -119,7 +119,7 @@ static PyObject *Vector_normalize(VectorObject *self) int i; float norm = 0.0f; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; for (i = 0; i < self->size; i++) { @@ -156,13 +156,13 @@ PyDoc_STRVAR(Vector_resize_2d_doc, ); static PyObject *Vector_resize_2d(VectorObject *self) { - if(self->wrapped==Py_WRAP) { + if (self->wrapped==Py_WRAP) { PyErr_SetString(PyExc_TypeError, "Vector.resize_2d(): " "cannot resize wrapped data - only python vectors"); return NULL; } - if(self->cb_user) { + if (self->cb_user) { PyErr_SetString(PyExc_TypeError, "Vector.resize_2d(): " "cannot resize a vector that has an owner"); @@ -170,7 +170,7 @@ static PyObject *Vector_resize_2d(VectorObject *self) } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2)); - if(self->vec == NULL) { + if (self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "Vector.resize_2d(): " "problem allocating pointer space"); @@ -197,7 +197,7 @@ static PyObject *Vector_resize_3d(VectorObject *self) "cannot resize wrapped data - only python vectors"); return NULL; } - if(self->cb_user) { + if (self->cb_user) { PyErr_SetString(PyExc_TypeError, "Vector.resize_3d(): " "cannot resize a vector that has an owner"); @@ -205,14 +205,14 @@ static PyObject *Vector_resize_3d(VectorObject *self) } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3)); - if(self->vec == NULL) { + if (self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "Vector.resize_3d(): " "problem allocating pointer space"); return NULL; } - if(self->size == 2) + if (self->size == 2) self->vec[2] = 0.0f; self->size = 3; @@ -229,13 +229,13 @@ PyDoc_STRVAR(Vector_resize_4d_doc, ); static PyObject *Vector_resize_4d(VectorObject *self) { - if(self->wrapped==Py_WRAP) { + if (self->wrapped==Py_WRAP) { PyErr_SetString(PyExc_TypeError, "Vector.resize_4d(): " "cannot resize wrapped data - only python vectors"); return NULL; } - if(self->cb_user) { + if (self->cb_user) { PyErr_SetString(PyExc_TypeError, "Vector.resize_4d(): " "cannot resize a vector that has an owner"); @@ -243,18 +243,18 @@ static PyObject *Vector_resize_4d(VectorObject *self) } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4)); - if(self->vec == NULL) { + if (self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "Vector.resize_4d(): " "problem allocating pointer space"); return NULL; } - if(self->size == 2) { + if (self->size == 2) { self->vec[2] = 0.0f; self->vec[3] = 1.0f; } - else if(self->size == 3) { + else if (self->size == 3) { self->vec[3] = 1.0f; } self->size = 4; @@ -270,7 +270,7 @@ PyDoc_STRVAR(Vector_to_2d_doc, ); static PyObject *Vector_to_2d(VectorObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self)); @@ -287,7 +287,7 @@ static PyObject *Vector_to_3d(VectorObject *self) { float tvec[3]= {0.0f}; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3)); @@ -305,7 +305,7 @@ static PyObject *Vector_to_4d(VectorObject *self) { float tvec[4]= {0.0f, 0.0f, 0.0f, 1.0f}; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 4)); @@ -330,7 +330,7 @@ static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits) ret= PyTuple_New(self->size); - if(ndigits >= 0) { + if (ndigits >= 0) { for (i = 0; i < self->size; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits))); } @@ -348,20 +348,20 @@ static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args) { int ndigits= 0; - if(!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits)) + if (!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits)) return NULL; - if(ndigits > 22 || ndigits < 0) { + if (ndigits > 22 || ndigits < 0) { PyErr_SetString(PyExc_ValueError, "Vector.to_tuple(ndigits): " "ndigits must be between 0 and 21"); return NULL; } - if(PyTuple_GET_SIZE(args)==0) + if (PyTuple_GET_SIZE(args)==0) ndigits= -1; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return Vector_to_tuple_ext(self, ndigits); @@ -385,7 +385,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) const char *strack, *sup; short track = 2, up = 1; - if(!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup)) + if (!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup)) return NULL; if (self->size != 3) { @@ -395,7 +395,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) return NULL; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; if (strack) { @@ -508,10 +508,10 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value) float reflect[3] = {0.0f}; float tvec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if((value_size= mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1) + if ((value_size= mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1) return NULL; mirror[0] = tvec[0]; @@ -547,10 +547,10 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value) VectorObject *ret; float tvec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1) return NULL; ret= (VectorObject *)newVectorObject(NULL, 3, Py_NEW, Py_TYPE(self)); @@ -574,10 +574,10 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value) double dot = 0.0; int x; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) return NULL; for (x = 0; x < self->size; x++) { @@ -611,13 +611,13 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) int x; PyObject *fallback= NULL; - if(!PyArg_ParseTuple(args, "O|O:angle", &value, &fallback)) + if (!PyArg_ParseTuple(args, "O|O:angle", &value, &fallback)) return NULL; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tvec, size, size, value, "Vector.angle(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tvec, size, size, value, "Vector.angle(other), invalid 'other' arg") == -1) return NULL; for (x = 0; x < size; x++) { @@ -626,7 +626,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) } if (!test_v1 || !test_v2) { /* avoid exception */ - if(fallback) { + if (fallback) { Py_INCREF(fallback); return fallback; } @@ -648,7 +648,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) } PyDoc_STRVAR(Vector_rotation_difference_doc, -".. function:: difference(other)\n" +".. function:: rotation_difference(other)\n" "\n" " Returns a quaternion representing the rotational difference between this\n" " vector and another.\n" @@ -664,17 +664,17 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value) { float quat[4], vec_a[3], vec_b[3]; - if(self->size < 3) { + if (self->size < 3) { PyErr_SetString(PyExc_ValueError, "vec.difference(value): " "expects both vectors to be size 3 or 4"); return NULL; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(vec_b, 3, MAX_DIMENSIONS, value, "Vector.difference(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(vec_b, 3, MAX_DIMENSIONS, value, "Vector.difference(other), invalid 'other' arg") == -1) return NULL; normalize_v3_v3(vec_a, self->vec); @@ -703,13 +703,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value) double dot = 0.0f, dot2 = 0.0f; int x; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tvec, size, size, value, "Vector.project(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tvec, size, size, value, "Vector.project(other), invalid 'other' arg") == -1) return NULL; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; //get dot products @@ -745,13 +745,13 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args) float tvec[MAX_DIMENSIONS], vec[MAX_DIMENSIONS]; int x; - if(!PyArg_ParseTuple(args, "Of:lerp", &value, &fac)) + if (!PyArg_ParseTuple(args, "Of:lerp", &value, &fac)) return NULL; - if(mathutils_array_parse(tvec, size, size, value, "Vector.lerp(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tvec, size, size, value, "Vector.lerp(other), invalid 'other' arg") == -1) return NULL; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; ifac= 1.0f - fac; @@ -774,13 +774,13 @@ static PyObject *Vector_rotate(VectorObject *self, PyObject *value) { float other_rmat[3][3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_any_to_rotmat(other_rmat, value, "Vector.rotate(value)") == -1) + if (mathutils_any_to_rotmat(other_rmat, value, "Vector.rotate(value)") == -1) return NULL; - if(self->size < 3) { + if (self->size < 3) { PyErr_SetString(PyExc_ValueError, "Vector must be 3D or 4D"); return NULL; @@ -805,7 +805,7 @@ PyDoc_STRVAR(Vector_copy_doc, ); static PyObject *Vector_copy(VectorObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return newVectorObject(self->vec, self->size, Py_NEW, Py_TYPE(self)); @@ -815,7 +815,7 @@ static PyObject *Vector_repr(VectorObject *self) { PyObject *ret, *tuple; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; tuple= Vector_to_tuple_ext(self, -1); @@ -833,10 +833,10 @@ static int Vector_len(VectorObject *self) /* sequence accessor (get): vector[index] */ static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr) { - if(i<0) i= self->size-i; + if (i<0) i= self->size-i; - if(i < 0 || i >= self->size) { - if(is_attr) { + if (i < 0 || i >= self->size) { + if (is_attr) { PyErr_Format(PyExc_AttributeError, "Vector.%c: unavailable on %dd vector", *(((char *)"xyzw") + i), self->size); @@ -848,7 +848,7 @@ static PyObject *vector_item_internal(VectorObject *self, int i, const int is_at return NULL; } - if(BaseMath_ReadIndexCallback(self, i) == -1) + if (BaseMath_ReadIndexCallback(self, i) == -1) return NULL; return PyFloat_FromDouble(self->vec[i]); @@ -862,17 +862,17 @@ static PyObject *Vector_item(VectorObject *self, int i) static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const int is_attr) { float scalar; - if((scalar=PyFloat_AsDouble(value))==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ + if ((scalar=PyFloat_AsDouble(value))==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "vector[index] = x: " "index argument not a number"); return -1; } - if(i<0) i= self->size-i; + if (i<0) i= self->size-i; - if(i < 0 || i >= self->size) { - if(is_attr) { + if (i < 0 || i >= self->size) { + if (is_attr) { PyErr_Format(PyExc_AttributeError, "Vector.%c = x: unavailable on %dd vector", *(((char *)"xyzw") + i), self->size); @@ -886,7 +886,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, } self->vec[i] = scalar; - if(BaseMath_WriteIndexCallback(self, i) == -1) + if (BaseMath_WriteIndexCallback(self, i) == -1) return -1; return 0; } @@ -902,7 +902,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end) PyObject *tuple; int count; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; CLAMP(begin, 0, self->size); @@ -923,7 +923,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se int y, size = 0; float vec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; CLAMP(begin, 0, self->size); @@ -931,7 +931,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se begin = MIN2(begin, end); size = (end - begin); - if(mathutils_array_parse(vec, size, size, seq, "vector[begin:end] = [...]") == -1) + if (mathutils_array_parse(vec, size, size, seq, "vector[begin:end] = [...]") == -1) return -1; /*parsed well - now set in vector*/ @@ -939,7 +939,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se self->vec[begin + y] = vec[y]; } - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; return 0; @@ -962,11 +962,11 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2) vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) return NULL; /*VECTOR + VECTOR*/ - if(vec1->size != vec2->size) { + if (vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector addition: " "vectors must have the same dimensions for this operation"); @@ -993,14 +993,14 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2) vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - if(vec1->size != vec2->size) { + if (vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector addition: " "vectors must have the same dimensions for this operation"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) return NULL; add_vn_vn(vec1->vec, vec2->vec, vec1->size); @@ -1026,10 +1026,10 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2) vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) return NULL; - if(vec1->size != vec2->size) { + if (vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector subtraction: " "vectors must have the same dimensions for this operation"); @@ -1056,14 +1056,14 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2) vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - if(vec1->size != vec2->size) { + if (vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector subtraction: " "vectors must have the same dimensions for this operation"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1) return NULL; sub_vn_vn(vec1->vec, vec2->vec, vec1->size); @@ -1091,8 +1091,8 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec, double dot = 0.0f; int x, y, z = 0; - if(mat->row_size != vec->size) { - if(mat->row_size == 4 && vec->size == 3) { + if (mat->row_size != vec->size) { + if (mat->row_size == 4 && vec->size == 3) { vec_cpy[3] = 1.0f; } else { @@ -1133,12 +1133,12 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) if VectorObject_Check(v1) { vec1= (VectorObject *)v1; - if(BaseMath_ReadCallback(vec1) == -1) + if (BaseMath_ReadCallback(vec1) == -1) return NULL; } if VectorObject_Check(v2) { vec2= (VectorObject *)v2; - if(BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec2) == -1) return NULL; } @@ -1148,7 +1148,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) int i; double dot = 0.0f; - if(vec1->size != vec2->size) { + if (vec1->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " "vectors must have the same dimensions for this operation"); @@ -1166,9 +1166,9 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) /* VEC * MATRIX */ float tvec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) + if (BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; - if(row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1) { + if (row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1) { return NULL; } @@ -1186,13 +1186,13 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) QuaternionObject *quat2 = (QuaternionObject*)v2; float tvec[3]; - if(vec1->size != 3) { + if (vec1->size != 3) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " "only 3D vector rotations (with quats) currently supported"); return NULL; } - if(BaseMath_ReadCallback(quat2) == -1) { + if (BaseMath_ReadCallback(quat2) == -1) { return NULL; } @@ -1228,7 +1228,7 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) VectorObject *vec = (VectorObject *)v1; float scalar; - if(BaseMath_ReadCallback(vec) == -1) + if (BaseMath_ReadCallback(vec) == -1) return NULL; /* only support vec*=float and vec*=mat @@ -1243,10 +1243,10 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) return NULL; #else float rvec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) + if (BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; - if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) + if (column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) return NULL; memcpy(vec->vec, rvec, sizeof(float) * vec->size); @@ -1266,14 +1266,14 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) #else QuaternionObject *quat2 = (QuaternionObject*)v2; - if(vec->size != 3) { + if (vec->size != 3) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " "only 3D vector rotations (with quats) currently supported"); return NULL; } - if(BaseMath_ReadCallback(quat2) == -1) { + if (BaseMath_ReadCallback(quat2) == -1) { return NULL; } @@ -1304,7 +1304,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2) float vec[4], scalar; VectorObject *vec1 = NULL; - if(!VectorObject_Check(v1)) { /* not a vector */ + if (!VectorObject_Check(v1)) { /* not a vector */ PyErr_SetString(PyExc_TypeError, "Vector division: " "Vector must be divided by a float"); @@ -1312,17 +1312,17 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2) } vec1 = (VectorObject*)v1; /* vector */ - if(BaseMath_ReadCallback(vec1) == -1) + if (BaseMath_ReadCallback(vec1) == -1) return NULL; - if((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ + if ((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Vector division: " "Vector must be divided by a float"); return NULL; } - if(scalar==0.0f) { + if (scalar==0.0f) { PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: " "divide by zero error"); @@ -1342,17 +1342,17 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2) float scalar; VectorObject *vec1 = (VectorObject*)v1; - if(BaseMath_ReadCallback(vec1) == -1) + if (BaseMath_ReadCallback(vec1) == -1) return NULL; - if((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ + if ((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Vector division: " "Vector must be divided by a float"); return NULL; } - if(scalar==0.0f) { + if (scalar==0.0f) { PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: " "divide by zero error"); @@ -1374,7 +1374,7 @@ static PyObject *Vector_neg(VectorObject *self) { float tvec[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; negate_vn_vn(tvec, self->vec, self->size); @@ -1418,7 +1418,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa vecA = (VectorObject*)objectA; vecB = (VectorObject*)objectB; - if(BaseMath_ReadCallback(vecA) == -1 || BaseMath_ReadCallback(vecB) == -1) + if (BaseMath_ReadCallback(vecA) == -1 || BaseMath_ReadCallback(vecB) == -1) return NULL; if (vecA->size != vecB->size) { @@ -1434,14 +1434,14 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa case Py_LT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA < lenB) { + if (lenA < lenB) { result = 1; } break; case Py_LE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA < lenB) { + if (lenA < lenB) { result = 1; } else { @@ -1457,14 +1457,14 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa case Py_GT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA > lenB) { + if (lenA > lenB) { result = 1; } break; case Py_GE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA > lenB) { + if (lenA > lenB) { result = 1; } else { @@ -1632,7 +1632,7 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) double dot = 0.0f; int i; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; for (i = 0; i < self->size; i++) { @@ -1646,10 +1646,10 @@ static int Vector_setLength(VectorObject *self, PyObject *value) double dot = 0.0f, param; int i; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; - if((param=PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred()) { + if ((param=PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "length must be set to a number"); return -1; @@ -1694,7 +1694,7 @@ static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closur double dot = 0.0f; int i; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; for (i = 0; i < self->size; i++) { @@ -1713,7 +1713,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) float vec[MAX_DIMENSIONS]; unsigned int swizzleClosure; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /* Unpack the axes from the closure into an array. */ @@ -1722,7 +1722,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) while (swizzleClosure & SWIZZLE_VALID_AXIS) { axis_from = swizzleClosure & SWIZZLE_AXIS; - if(axis_from >= self->size) { + if (axis_from >= self->size) { PyErr_SetString(PyExc_AttributeError, "Vector swizzle: " "specified axis not present"); @@ -1760,7 +1760,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure) float tvec[MAX_DIMENSIONS]; float vec_assign[MAX_DIMENSIONS]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; /* Check that the closure can be used with this vector: even 2D vectors have @@ -1787,11 +1787,11 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure) size_from= axis_from; } - else if(PyErr_Clear(), (size_from=mathutils_array_parse(vec_assign, 2, 4, value, "mathutils.Vector.**** = swizzle assignment")) == -1) { + else if (PyErr_Clear(), (size_from=mathutils_array_parse(vec_assign, 2, 4, value, "mathutils.Vector.**** = swizzle assignment")) == -1) { return -1; } - if(axis_from != size_from) { + if (axis_from != size_from) { PyErr_SetString(PyExc_AttributeError, "Vector swizzle: size does not match swizzle"); return -1; @@ -1811,7 +1811,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure) memcpy(self->vec, tvec, axis_from * sizeof(float)); /* continue with BaseMathObject_WriteCallback at the end */ - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; else return 0; @@ -2223,8 +2223,8 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v double dot = 0.0f; int x, y, z= 0, vec_size= vec->size; - if(mat->col_size != vec_size) { - if(mat->col_size == 4 && vec_size != 3) { + if (mat->col_size != vec_size) { + if (mat->col_size == 4 && vec_size != 3) { PyErr_SetString(PyExc_ValueError, "vector * matrix: matrix column size " "and the vector size must be the same"); @@ -2235,7 +2235,7 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v } } - if(BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1) + if (BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1) return -1; memcpy(vec_cpy, vec->vec, vec_size * sizeof(float)); @@ -2263,7 +2263,7 @@ PyDoc_STRVAR(Vector_negate_doc, ); static PyObject *Vector_negate(VectorObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; negate_vn(self->vec, self->size); @@ -2406,7 +2406,7 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje { VectorObject *self; - if(size > 4 || size < 2) { + if (size > 4 || size < 2) { PyErr_SetString(PyExc_RuntimeError, "Vector(): invalid size"); return NULL; @@ -2415,25 +2415,25 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje self= base_type ? (VectorObject *)base_type->tp_alloc(base_type, 0) : (VectorObject *)PyObject_GC_New(VectorObject, &vector_Type); - if(self) { + if (self) { self->size = size; /* init callbacks as NULL */ self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP) { + if (type == Py_WRAP) { self->vec = vec; self->wrapped = Py_WRAP; } else if (type == Py_NEW) { self->vec= PyMem_Malloc(size * sizeof(float)); - if(vec) { + if (vec) { memcpy(self->vec, vec, size * sizeof(float)); } else { /* new empty */ fill_vn(self->vec, size, 0.0f); - if(size == 4) { /* do the homogenous thing */ + if (size == 4) { /* do the homogenous thing */ self->vec[3] = 1.0f; } } @@ -2450,7 +2450,7 @@ PyObject *newVectorObject_cb(PyObject *cb_user, int size, int cb_type, int cb_su { float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */ VectorObject *self= (VectorObject *)newVectorObject(dummy, size, Py_NEW, NULL); - if(self) { + if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index dfa1c98b94b..3bf2997e8c9 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -48,8 +48,6 @@ #include "BLI_utildefines.h" #define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp -#define eps 0.000001 - /*-------------------------DOC STRINGS ---------------------------*/ PyDoc_STRVAR(M_Geometry_doc, From 01af54c4647f838e3e48bf7ffeb19e1729fc0c93 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 16 Nov 2011 10:00:02 +0000 Subject: [PATCH 119/203] Camera tracking: forbid focal length=0 and small code cleanup --- extern/libmv/libmv-capi.cpp | 13 +++++-------- source/blender/makesrna/intern/rna_tracking.c | 5 +++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp index 9d6cfd5d17a..8c453944e9d 100644 --- a/extern/libmv/libmv-capi.cpp +++ b/extern/libmv/libmv-capi.cpp @@ -368,14 +368,11 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra intrinsics->SetPrincipalPoint(principal_x, principal_y); intrinsics->SetRadialDistortion(k1, k2, k3); - if(focal_length) { - /* do a lens undistortion if focal length is non-zero only */ - for (int i = 0; i < markers.size(); ++i) { - intrinsics->InvertIntrinsics(markers[i].x, - markers[i].y, - &(markers[i].x), - &(markers[i].y)); - } + for (int i = 0; i < markers.size(); ++i) { + intrinsics->InvertIntrinsics(markers[i].x, + markers[i].y, + &(markers[i].x), + &(markers[i].y)); } libmv::Tracks normalized_tracks(markers); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 368359925c4..73b2914fba1 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -169,7 +169,8 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value) if(clip->lastsize[0]) value= clip->lastsize[0]*value/camera->sensor_width; - camera->focal= value; + if(value>=0.0001) + camera->focal= value; } static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data) @@ -372,7 +373,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna) /* Focal Length */ prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "focal"); - RNA_def_property_range(prop, 0.0f, 5000.0f); + RNA_def_property_range(prop, 0.0001f, 5000.0f); RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL); RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); From bb04fc124611355f97be8b6ecbf983aca07adee5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 16 Nov 2011 11:52:31 +0000 Subject: [PATCH 120/203] CLIP_OT_delete_proxy missed a space-type test in its poll func (was noisy with the space-menu in 3D views :P ). --- release/scripts/startup/bl_operators/clip.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 091e3defbf8..7900cb46e95 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -124,6 +124,9 @@ class CLIP_OT_delete_proxy(Operator): @classmethod def poll(cls, context): + if context.space_data.type != 'CLIP_EDITOR': + return False + sc = context.space_data return sc.clip From eff7e18dc50587a853093d2ddf27e551786e05a1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 12:27:24 +0000 Subject: [PATCH 121/203] Fix #29288: armature draw type wire + manipulator draw issue. --- source/blender/editors/space_view3d/drawarmature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index c0046b089af..bbc72500df4 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1946,7 +1946,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, index+= 0x10000; } /* restore things */ - if ((arm->drawtype!=ARM_LINE)&& (dt>OB_WIRE) && (arm->flag & ARM_POSEMODE)) + if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt>OB_WIRE) && (arm->flag & ARM_POSEMODE)) bglPolygonOffset(rv3d->dist, 0.0); } From 391f40e8c9647c2c436ef8681061d57300d2f287 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 16 Nov 2011 12:43:12 +0000 Subject: [PATCH 122/203] Default cache file paths for ocean and fluidsim modifiers are now "/ocean_cache/" and "/fluid_cache/" when the file is not saved yet at the time the modifiers are created. If it has been saved, the file paths are relative to the .blend: "//ocean_cache/" and "//fluid_cache/". This should at least partially fix bug #29273. Particle external point caches are not changed. http://projects.blender.org/tracker/?func=detail&atid=498&aid=29273&group_id=9 --- .../modifiers/intern/MOD_fluidsim_util.c | 18 ++++++++++++++++- source/blender/modifiers/intern/MOD_ocean.c | 20 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 1baa03d2063..15e1cdfcb62 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -69,6 +69,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) if(fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); + int surfdataPathMax = FILE_MAX; fluidmd->fss = fss; @@ -104,7 +105,22 @@ void fluidsim_init(FluidsimModifierData *fluidmd) /* elubie: changed this to default to the same dir as the render output to prevent saving to C:\ on Windows */ - BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), FILE_MAX); + if (G.relbase_valid) { /* is the .blend saved? */ + /* subfolder next to saved file */ + BLI_strncpy(fss->surfdataPath, "//fluid_cache", surfdataPathMax); + BLI_add_slash(fss->surfdataPath); + } + else { + /* subfolder in temp. directory */ + BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), surfdataPathMax); + surfdataPathMax -= strlen(fss->surfdataPath); + if (surfdataPathMax > 1) { + BLI_strncpy(fss->surfdataPath+strlen(fss->surfdataPath), "fluid_cache", surfdataPathMax); + surfdataPathMax -= strlen("fluid_cache"); + if (surfdataPathMax > 1) + BLI_add_slash(fss->surfdataPath); + } + } // first init of bounding box // no bounding box needed diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index a61cc856662..55d121737c1 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -34,10 +34,12 @@ #include "DNA_scene_types.h" #include "BKE_cdderivedmesh.h" +#include "BKE_global.h" #include "BKE_modifier.h" #include "BKE_ocean.h" #include "BKE_utildefines.h" +#include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_math_inline.h" #include "BLI_utildefines.h" @@ -95,6 +97,7 @@ static void initData(ModifierData *md) { #ifdef WITH_OCEANSIM OceanModifierData *omd = (OceanModifierData*) md; + int cachepathmax = sizeof(omd->cachepath); omd->resolution = 7; omd->spatial_size = 50; @@ -122,7 +125,22 @@ static void initData(ModifierData *md) omd->repeat_x = 1; omd->repeat_y = 1; - BLI_strncpy(omd->cachepath, "//ocean_cache", sizeof(omd->cachepath)); + if (G.relbase_valid) { /* is the .blend saved? */ + /* subfolder next to saved file */ + BLI_strncpy(omd->cachepath, "//ocean_cache", cachepathmax); + BLI_add_slash(omd->cachepath); + } + else { + /* subfolder in temp. directory */ + BLI_strncpy(omd->cachepath, BLI_temporary_dir(), cachepathmax); + cachepathmax -= strlen(omd->cachepath); + if (cachepathmax > 1) { + BLI_strncpy(omd->cachepath+strlen(omd->cachepath), "ocean_cache", cachepathmax); + cachepathmax -= strlen("ocean_cache"); + if (cachepathmax > 1) + BLI_add_slash(omd->cachepath); + } + } omd->cached = 0; omd->bakestart = 1; From c4e029a274b04ec6adb5e16a6c1ee5bea67fa01e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 12:47:37 +0000 Subject: [PATCH 123/203] Fix #29287: cycles and other external render engines did not print correct frame number in background render. --- source/blender/editors/render/render_internal.c | 7 +++++-- source/blender/render/intern/source/external_engine.c | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index cc1c8843015..6931b0b86db 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -322,10 +322,13 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) spos+= sprintf(spos, "%s ", rs->statstr); } else { - spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d ", (scene->r.cfra), rs->totvert, rs->totface); + spos+= sprintf(spos, "Fra:%d ", (scene->r.cfra)); + if(rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert); + if(rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface); if(rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo); if(rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand); - spos+= sprintf(spos, "La:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->totlamp, megs_used_memory, mmap_used_memory, megs_peak_memory); + if(rs->totlamp) spos+= sprintf(spos, "La:%d ", rs->totlamp); + spos+= sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory); if(rs->curfield) spos+= sprintf(spos, "Field %d ", rs->curfield); diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index b7f89e260a8..38ace8d5121 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -283,6 +283,11 @@ int RE_engine_render(Render *re, int do_all) if(re->result==NULL) return 1; + /* set render info */ + re->i.cfra= re->scene->r.cfra; + BLI_strncpy(re->i.scenename, re->scene->id.name+2, sizeof(re->i.scenename)); + re->i.totface=re->i.totvert=re->i.totstrand=re->i.totlamp=re->i.tothalo= 0; + /* render */ engine = RE_engine_create(type); engine->re= re; From 7177ee0245713ed22fda6e9ffbbac4e6391910c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 16 Nov 2011 13:39:58 +0000 Subject: [PATCH 124/203] Pep8 changes for motion tracking py scripts --- release/scripts/startup/bl_operators/clip.py | 7 +++++-- release/scripts/startup/bl_ui/space_clip.py | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 7900cb46e95..b805178bdc8 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -36,6 +36,7 @@ def CLIP_track_view_selected(sc, track): return False + class CLIP_OT_track_to_empty(Operator): """Create an Empty object which will be copying movement of active track""" @@ -190,7 +191,8 @@ class CLIP_OT_delete_proxy(Operator): class CLIP_OT_set_viewport_background(Operator): - """Set current movie clip as a camera background in 3D viewport (works only when a 3D viewport is visible)""" + """Set current movie clip as a camera background in 3D viewport \ +(works only when a 3D viewport is visible)""" bl_idname = "clip.set_viewport_background" bl_label = "Set as Background" @@ -239,7 +241,8 @@ class CLIP_OT_set_viewport_background(Operator): class CLIP_OT_constraint_to_fcurve(Operator): - """Create F-Curves for object which will copy object's movement caused by this constraint""" + """Create F-Curves for object which will copy \ +object's movement caused by this constraint""" bl_idname = "clip.constraint_to_fcurve" bl_label = "Constraint to F-Curve" diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index c6af6bab1d1..aa1ffe4ca36 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -54,7 +54,8 @@ class CLIP_HT_header(Header): row = layout.row(align=True) if sc.show_filters: - row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN', text="Filters") + row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN', + text="Filters") sub = row.column() sub.active = clip.tracking.reconstruction.is_valid @@ -62,7 +63,8 @@ class CLIP_HT_header(Header): row.prop(sc, "show_graph_tracks", icon='ANIM', text="") else: - row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT', text="Filters") + row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT', + text="Filters") row = layout.row() row.template_ID(sc, "clip", open='clip.open') @@ -719,7 +721,8 @@ class CLIP_MT_track(Menu): props = layout.operator("clip.clear_track_path", text="Clear Before") props.action = 'UPTO' - props = layout.operator("clip.clear_track_path", text="Clear Track Path") + props = layout.operator("clip.clear_track_path", + text="Clear Track Path") props.action = 'ALL' layout.separator() From ed5815fc7fb6be111fca613d0500418c4955e217 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 13:49:51 +0000 Subject: [PATCH 125/203] Fix #29243: unlink texture datablock from material node in texture properties could crash, RNA pointer from context was invalid. --- source/blender/editors/space_buttons/buttons_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 9de804d275f..4c028612320 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -805,7 +805,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ma) { bNode *node= give_current_material_texture_node(ma); - CTX_data_pointer_set(result, &ma->id, &RNA_Node, node); + CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node); } } From 004cb6ba1b96e3a4857f08255f2be9fe873b69fb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 14:13:43 +0000 Subject: [PATCH 126/203] Fix #29160: material node "Texture" didn't use default texture coordinates anymore when nothing was connected to the socket. --- source/blender/nodes/shader/nodes/node_shader_texture.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c index dbf9fdbdb7e..c26cf2451df 100644 --- a/source/blender/nodes/shader/nodes/node_shader_texture.c +++ b/source/blender/nodes/shader/nodes/node_shader_texture.c @@ -51,6 +51,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b if(data && node->id) { ShadeInput *shi= ((ShaderCallData *)data)->shi; TexResult texres; + bNodeSocket *sock_vector= node->inputs.first; float vec[3], nor[3]={0.0f, 0.0f, 0.0f}; int retval; short which_output = node->custom1; @@ -63,7 +64,8 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b texres.nor= nor; texres.tr= texres.tg= texres.tb= 0.0f; - if(in[0]->hasinput) { + /* don't use in[0]->hasinput, see material node for explanation */ + if(sock_vector->link) { nodestack_get_vec(vec, SOCK_VECTOR, in[0]); if(in[0]->datatype==NS_OSA_VECTORS) { From c6bbe25c291b7729637871f6ddc1f4415b107763 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 15:47:25 +0000 Subject: [PATCH 127/203] Fix #29093: world zenith up and down texture influence were not working correct. These were decoupled from horizon influence for 2.5, but not actually used in the render engine. --- .../render/intern/source/render_texture.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index bd323a5b2d3..323f04cbd04 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -3007,7 +3007,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; float *co, fact, stencilTin=1.0; float tempvec[3], texvec[3], dxt[3], dyt[3]; - int tex_nr, rgb= 0, ok; + int tex_nr, rgb= 0; if (R.r.scemode & R_NO_TEX) return; /* todo: add flag to test if there's a tex */ @@ -3171,18 +3171,21 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h texture_rgb_blend(hor, tcol, hor, texres.tin, mtex->colfac, mtex->blendtype); } if(mtex->mapto & (WOMAP_ZENUP+WOMAP_ZENDOWN)) { - ok= 0; + float zenfac = 0.0f; + if(R.wrld.skytype & WO_SKYREAL) { if((skyflag & WO_ZENUP)) { - if(mtex->mapto & WOMAP_ZENUP) ok= 1; + if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac; } - else if(mtex->mapto & WOMAP_ZENDOWN) ok= 1; + else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac; + } + else { + if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac; + else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac; } - else ok= 1; - if(ok) { - texture_rgb_blend(zen, tcol, zen, texres.tin, mtex->colfac, mtex->blendtype); - } + if(zenfac != 0.0f) + texture_rgb_blend(zen, tcol, zen, texres.tin, zenfac, mtex->blendtype); } } if(mtex->mapto & WOMAP_BLEND) { From cb09ad43e1a26f1c742d310e27e562c8084c0194 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 16:08:45 +0000 Subject: [PATCH 128/203] Fix #29293: NLA Strip modifiers don't survive save/reload. One letter can make a big difference :) --- source/blender/blenloader/intern/readfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1c4a4567401..79ab90d06fb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1979,7 +1979,7 @@ static void direct_link_nladata_strips(FileData *fd, ListBase *list) /* strip's F-Modifiers */ link_list(fd, &strip->modifiers); - direct_link_modifiers(fd, &strip->modifiers); + direct_link_fmodifiers(fd, &strip->modifiers); } } From b4d453212ae2142d537f0824b3ff0627fca85277 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 16:10:11 +0000 Subject: [PATCH 129/203] Fix #29292: cycles not loading linked image datablocks correctly. --- intern/cycles/blender/blender_util.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index c5cceff6242..ff6d55c6f3e 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -176,7 +176,13 @@ static inline string get_enum_identifier(PointerRNA& ptr, const char *name) static inline string blender_absolute_path(BL::BlendData b_data, BL::ID b_id, const string& path) { if(path.size() >= 2 && path[0] == '/' && path[1] == '/') { - string dirname = (b_id.library())? b_id.library().filepath(): b_data.filepath(); + string dirname; + + if(b_id.library()) + dirname = blender_absolute_path(b_data, b_id.library(), b_id.library().filepath()); + else + dirname = b_data.filepath(); + return path_join(path_dirname(dirname), path.substr(2)); } From 0566694f6e294e50030c61cbd2544b5d469651ce Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 16:28:19 +0000 Subject: [PATCH 130/203] Cycles: cmake build system tweak, might solve compile issue. --- intern/cycles/blender/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index f3da1a30eb2..ea46911ce16 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -1,4 +1,11 @@ +set(BLENDER_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/intern/guardedalloc + ${CMAKE_SOURCE_DIR}/source/blender/makesdna + ${CMAKE_SOURCE_DIR}/source/blender/makesrna + ${CMAKE_SOURCE_DIR}/source/blender/blenloader + ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern) + set(INC ../render ../device From 4d9766aacf274e42b940b04c6a13b2b57043ca64 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 16:38:37 +0000 Subject: [PATCH 131/203] minor cleanup - remove / comment unused python vars - replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec); --- .../cmake/Modules/FindPythonLibsUnix.cmake | 10 ++++---- intern/cycles/blender/addon/ui.py | 14 +++++------ release/scripts/modules/bpy/path.py | 23 ++++++++----------- release/scripts/presets/camera/Sony_A55.py | 1 - release/scripts/startup/bl_operators/clip.py | 7 +----- release/scripts/startup/bl_operators/image.py | 2 +- release/scripts/startup/bl_operators/wm.py | 2 +- .../bl_ui/properties_physics_dynamicpaint.py | 6 ----- release/scripts/startup/bl_ui/space_clip.py | 7 ------ release/scripts/startup/bl_ui/space_view3d.py | 17 ++++---------- .../blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/particle.c | 4 ++-- .../blenkernel/intern/particle_system.c | 4 ++-- 13 files changed, 35 insertions(+), 64 deletions(-) diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake index 8c3ff64d3f3..448e587e224 100644 --- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -139,9 +139,9 @@ IF(PYTHONLIBSUNIX_FOUND) # not used # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "") - - MARK_AS_ADVANCED( - PYTHON_INCLUDE_DIR - PYTHON_LIBRARY - ) ENDIF() + +MARK_AS_ADVANCED( + PYTHON_INCLUDE_DIR + PYTHON_LIBRARY +) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index d96efe93cf8..00010bb7463 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -459,7 +459,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - world = context.world + # world = context.world return False # world and world.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): @@ -493,7 +493,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - mat = context.material + # mat = context.material return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): @@ -562,7 +562,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): pin_id = space.pin_id use_pin_id = space.use_pin_id user = context.texture_user - node = context.texture_node + # node = context.texture_node if not use_pin_id or not isinstance(pin_id, bpy.types.Texture): pin_id = None @@ -638,7 +638,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout - tex = context.texture + # tex = context.texture node = context.texture_node mapping = node.texture_mapping @@ -664,15 +664,15 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - tex = context.texture - node = context.texture_node + # tex = context.texture + # node = context.texture_node return False #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout - tex = context.texture + # tex = context.texture node = context.texture_node mapping = node.color_mapping diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index e6d0fbb99a2..4173d71b39c 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -154,25 +154,23 @@ def resolve_ncase(path): returning a string with the path if found else return the original path. """ - import os - def _ncase_path_found(path): - if not path or os.path.exists(path): + if not path or _os.path.exists(path): return path, True # filename may be a directory or a file - filename = os.path.basename(path) - dirpath = os.path.dirname(path) + filename = _os.path.basename(path) + dirpath = _os.path.dirname(path) suffix = path[:0] # "" but ensure byte/str match if not filename: # dir ends with a slash? if len(dirpath) < len(path): suffix = path[:len(path) - len(dirpath)] - filename = os.path.basename(dirpath) - dirpath = os.path.dirname(dirpath) + filename = _os.path.basename(dirpath) + dirpath = _os.path.dirname(dirpath) - if not os.path.exists(dirpath): + if not _os.path.exists(dirpath): if dirpath == path: return path, False @@ -184,8 +182,8 @@ def resolve_ncase(path): # at this point, the directory exists but not the file # we are expecting 'dirpath' to be a directory, but it could be a file - if os.path.isdir(dirpath): - files = os.listdir(dirpath) + if _os.path.isdir(dirpath): + files = _os.listdir(dirpath) else: return path, False @@ -198,7 +196,7 @@ def resolve_ncase(path): break if f_iter_nocase: - return os.path.join(dirpath, f_iter_nocase) + suffix, True + return _os.path.join(dirpath, f_iter_nocase) + suffix, True else: # cant find the right one, just return the path as is. return path, False @@ -216,8 +214,7 @@ def ensure_ext(filepath, ext, case_sensitive=False): :arg case_sensitive: Check for matching case when comparing extensions. :type case_sensitive: bool """ - import os - fn_base, fn_ext = os.path.splitext(filepath) + fn_base, fn_ext = _os.path.splitext(filepath) if fn_base and fn_ext: if ((case_sensitive and ext == fn_ext) or (ext.lower() == fn_ext.lower())): diff --git a/release/scripts/presets/camera/Sony_A55.py b/release/scripts/presets/camera/Sony_A55.py index 0de8198972a..b0f172206fa 100644 --- a/release/scripts/presets/camera/Sony_A55.py +++ b/release/scripts/presets/camera/Sony_A55.py @@ -2,4 +2,3 @@ import bpy bpy.context.object.data.sensor_width = 23.4 bpy.context.object.data.sensor_height = 15.6 bpy.context.object.data.sensor_fit = 'HORIZONTAL' - diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index b805178bdc8..d5d9684bcf3 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -86,13 +86,8 @@ class CLIP_OT_tracks_to_mesh(Operator): @classmethod def poll(cls, context): - if context.space_data.type != 'CLIP_EDITOR': - return False - sc = context.space_data - clip = sc.clip - - return clip + return (sc.type == 'CLIP_EDITOR') and sc.clip def execute(self, context): sc = context.space_data diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index 8c12a6442f7..c97f6eae6c7 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -147,7 +147,7 @@ class ProjectEdit(Operator): # opengl buffer may fail, we can't help this, but best report it. try: - ret = bpy.ops.paint.image_from_view() + bpy.ops.paint.image_from_view() except RuntimeError as err: self.report({'ERROR'}, str(err)) return {'CANCELLED'} diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index aa661b76512..14c9a090529 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -106,7 +106,7 @@ def operator_path_is_undo(context, data_path): # luckily we don't do this! # # When we cant find the data owner assume no undo is needed. - data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".") + data_path_head = data_path.rpartition(".")[0] if not data_path_head: return False diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 4e6c4063d2c..68fa0cedaa3 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -46,7 +46,6 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel): layout = self.layout md = context.dynamic_paint - ob = context.object layout.prop(md, "ui_type", expand=True) @@ -129,7 +128,6 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel): canvas = context.dynamic_paint.canvas_settings surface = canvas.canvas_surfaces.active - ob = context.object surface_type = surface.surface_type @@ -370,8 +368,6 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel): md.canvas_settings.canvas_surfaces.active.is_cache_user) def draw(self, context): - layout = self.layout - surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active cache = surface.point_cache @@ -442,7 +438,6 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel): layout = self.layout brush = context.dynamic_paint.brush_settings - ob = context.object split = layout.split() @@ -478,7 +473,6 @@ class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel): layout = self.layout brush = context.dynamic_paint.brush_settings - ob = context.object layout.prop(brush, "wave_type") if brush.wave_type != 'REFLECT': diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index aa1ffe4ca36..237dd7f998d 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -115,7 +115,6 @@ class CLIP_PT_tools_tracking(Panel): def draw(self, context): layout = self.layout clip = context.space_data.clip - settings = clip.tracking.settings row = layout.row(align=True) @@ -641,7 +640,6 @@ class CLIP_PT_tools_clip(Panel): def draw(self, context): layout = self.layout - clip = context.space_data.clip layout.operator("clip.set_viewport_background") @@ -698,9 +696,6 @@ class CLIP_MT_proxy(Menu): def draw(self, context): layout = self.layout - sc = context.space_data - clip = sc.clip - layout.operator("clip.rebuild_proxy") layout.operator("clip.delete_proxy") @@ -805,8 +800,6 @@ class CLIP_MT_select(Menu): def draw(self, context): layout = self.layout - sc = context.space_data - layout.operator("clip.select_border") layout.operator("clip.select_circle") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 536936105e3..6bf8dd82c9b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2276,12 +2276,6 @@ class VIEW3D_PT_background_image(Panel): bl_label = "Background Images" bl_options = {'DEFAULT_CLOSED'} - @classmethod - def poll(cls, context): - view = context.space_data - #~ bg = context.space_data.background_image - return (view) - def draw_header(self, context): layout = self.layout view = context.space_data @@ -2315,16 +2309,15 @@ class VIEW3D_PT_background_image(Panel): row = box.row() row.prop(bg, "source", expand=True) - hasbg = False + has_bg = False if bg.source == 'IMAGE': row = box.row() row.template_ID(bg, "image", open="image.open") if (bg.image): box.template_image(bg, "image", bg.image_user, compact=True) - hasbg = True + has_bg = True elif bg.source == 'MOVIE': - has_clip = False box.prop(bg, 'use_camera_clip') column = box.column() @@ -2335,14 +2328,14 @@ class VIEW3D_PT_background_image(Panel): column.template_movieclip(bg, "clip", compact=True) if bg.use_camera_clip or bg.clip: - hasbg = True + has_bg = True column = box.column() - column.active = hasbg + column.active = has_bg column.prop(bg.clip_user, "proxy_render_size", text="") column.prop(bg.clip_user, "use_render_undistorted") - if hasbg: + if has_bg: box.prop(bg, "opacity", slider=True) if bg.view_axis != 'CAMERA': box.prop(bg, "size") diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 532e6f797dd..522aed439aa 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3235,7 +3235,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* Also cast a ray in opposite direction to make sure * point is at least surrounded by two brush faces */ - mul_v3_fl(ray_dir, -1.0f); + negate_v3(ray_dir); hit.index = -1; hit.dist = 9999; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d28fe8b8509..220068780a7 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1911,7 +1911,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float switch(type) { case PART_KINK_CURL: { - mul_v3_fl(par_vec, -1.f); + negate_v3(par_vec); if(flat > 0.f) { float proj[3]; @@ -1977,7 +1977,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float mul_qt_v3(par_rot, z_vec); } - mul_v3_fl(par_vec, -1.f); + negate_v3(par_vec); normalize_v3_v3(vec_one, par_vec); inp_y=dot_v3v3(y_vec, vec_one); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index cb12230615e..74fd8ff128b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2679,7 +2679,7 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi } if(pce->inv_nor == 1) { - mul_v3_fl(nor, -1.f); + negate_v3(nor); d = -d; } @@ -2799,7 +2799,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce normalize_v3(nor); if(pce->inv_nor == 1) - mul_v3_fl(nor, -1.f); + negate_v3(nor); madd_v3_v3v3fl(co, pce->x0, nor, col->radius); madd_v3_v3fl(co, e1, pce->uv[0]); From 1af839081b7adcc3ceb13e5e7cc579b309e90915 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 16:50:30 +0000 Subject: [PATCH 132/203] minor edits, move mempool stack vars into the nested scope when they aren't likely to be used, also formatting edits (was quite un-blender like). --- source/blender/blenlib/intern/BLI_mempool.c | 77 +++++++++++---------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index b4dc5b73a65..7e79b9f65a1 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -39,25 +39,26 @@ #include "BLI_mempool.h" #include -typedef struct BLI_freenode{ +typedef struct BLI_freenode { struct BLI_freenode *next; -}BLI_freenode; +} BLI_freenode; -typedef struct BLI_mempool_chunk{ +typedef struct BLI_mempool_chunk { struct BLI_mempool_chunk *next, *prev; void *data; -}BLI_mempool_chunk; +} BLI_mempool_chunk; -typedef struct BLI_mempool{ +typedef struct BLI_mempool { struct ListBase chunks; int esize, csize, pchunk; /*size of elements and chunks in bytes and number of elements per chunk*/ struct BLI_freenode *free; /*free element list. Interleaved into chunk datas.*/ int totalloc, totused; /*total number of elements allocated in total, and currently in use*/ int use_sysmalloc; -}BLI_mempool; +} BLI_mempool; BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmalloc) -{ BLI_mempool *pool = NULL; +{ + BLI_mempool *pool = NULL; BLI_freenode *lasttail = NULL, *curnode = NULL; int i,j, maxchunks; char *addr; @@ -69,7 +70,7 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmall pool = use_sysmalloc ? malloc(sizeof(BLI_mempool)) : MEM_mallocN(sizeof(BLI_mempool), "memory pool"); pool->esize = esize; pool->use_sysmalloc = use_sysmalloc; - pool->pchunk = pchunk; + pool->pchunk = pchunk; pool->csize = esize * pchunk; pool->chunks.first = pool->chunks.last = NULL; pool->totused= 0; @@ -77,21 +78,21 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmall maxchunks = tote / pchunk + 1; /*allocate the actual chunks*/ - for(i=0; i < maxchunks; i++){ + for (i=0; i < maxchunks; i++) { BLI_mempool_chunk *mpchunk = use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); mpchunk->next = mpchunk->prev = NULL; mpchunk->data = use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI Mempool Chunk Data"); BLI_addtail(&(pool->chunks), mpchunk); - if(i==0) pool->free = mpchunk->data; /*start of the list*/ + if (i==0) pool->free = mpchunk->data; /*start of the list*/ /*loop through the allocated data, building the pointer structures*/ - for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){ + for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) { curnode = ((BLI_freenode*)addr); addr += pool->esize; curnode->next = (BLI_freenode*)addr; } /*final pointer in the previously allocated chunk is wrong.*/ - if(lasttail) lasttail->next = mpchunk->data; + if (lasttail) lasttail->next = mpchunk->data; /*set the end of this chunks memoryy to the new tail for next iteration*/ lasttail = curnode; @@ -101,15 +102,18 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmall curnode->next = NULL; return pool; } -void *BLI_mempool_alloc(BLI_mempool *pool){ + +void *BLI_mempool_alloc(BLI_mempool *pool) +{ void *retval=NULL; - BLI_freenode *curnode=NULL; - char *addr=NULL; - int j; pool->totused++; - if(!(pool->free)){ + if (!(pool->free)) { + BLI_freenode *curnode=NULL; + char *addr; + int j; + /*need to allocate a new chunk*/ BLI_mempool_chunk *mpchunk = pool->use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); mpchunk->next = mpchunk->prev = NULL; @@ -117,7 +121,7 @@ void *BLI_mempool_alloc(BLI_mempool *pool){ BLI_addtail(&(pool->chunks), mpchunk); pool->free = mpchunk->data; /*start of the list*/ - for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){ + for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) { curnode = ((BLI_freenode*)addr); addr += pool->esize; curnode->next = (BLI_freenode*)addr; @@ -133,19 +137,17 @@ void *BLI_mempool_alloc(BLI_mempool *pool){ return retval; } -void *BLI_mempool_calloc(BLI_mempool *pool){ - void *retval=NULL; - retval = BLI_mempool_alloc(pool); +void *BLI_mempool_calloc(BLI_mempool *pool) +{ + void *retval= BLI_mempool_alloc(pool); memset(retval, 0, pool->esize); return retval; } - -void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against double frees, dont be stupid! +/* doesnt protect against double frees, dont be stupid! */ +void BLI_mempool_free(BLI_mempool *pool, void *addr) +{ BLI_freenode *newhead = addr; - BLI_freenode *curnode=NULL; - char *tmpaddr=NULL; - int i; newhead->next = pool->free; pool->free = newhead; @@ -154,14 +156,18 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d /*nothing is in use; free all the chunks except the first*/ if (pool->totused == 0) { - BLI_mempool_chunk *mpchunk=NULL, *first; + BLI_freenode *curnode=NULL; + char *tmpaddr=NULL; + int i; + + BLI_mempool_chunk *mpchunk=NULL; + BLI_mempool_chunk *first= pool->chunks.first; - first = pool->chunks.first; BLI_remlink(&pool->chunks, first); - for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { - if(pool->use_sysmalloc) free(mpchunk->data); - else MEM_freeN(mpchunk->data); + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + if (pool->use_sysmalloc) free(mpchunk->data); + else MEM_freeN(mpchunk->data); } pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); @@ -170,7 +176,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d pool->totalloc = pool->pchunk; pool->free = first->data; /*start of the list*/ - for(tmpaddr = first->data, i=0; i < pool->pchunk; i++){ + for (tmpaddr = first->data, i=0; i < pool->pchunk; i++) { curnode = ((BLI_freenode*)tmpaddr); tmpaddr += pool->esize; curnode->next = (BLI_freenode*)tmpaddr; @@ -182,15 +188,16 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk=NULL; - if(pool->use_sysmalloc) { - for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + + if (pool->use_sysmalloc) { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { free(mpchunk->data); } BLI_freelist(&(pool->chunks)); free(pool); } else { - for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { MEM_freeN(mpchunk->data); } BLI_freelistN(&(pool->chunks)); From 9f51785c4d0038d24fed473dc1d803458f838884 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Wed, 16 Nov 2011 18:32:28 +0000 Subject: [PATCH 133/203] Dynamic Paint: * Wave simulation speed doesn't anymore depend on surface size, but uses relative distances instead. This change will likely change simulation behavior on existing saves, but can be easily tweaked back using the "Wave Speed" parameter. * Added a new wave brush type, "Depth Change". It uses the change of brush intersection between frames, giving a better looking "wake" for moving objects. It also doesn't leave any "dent" to the surface while remaining still. --- source/blender/blenkernel/BKE_dynamicpaint.h | 2 ++ .../blender/blenkernel/intern/dynamicpaint.c | 36 ++++++++++++++----- .../blender/makesdna/DNA_dynamicpaint_types.h | 1 + .../makesrna/intern/rna_dynamicpaint.c | 7 ++-- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index a4a810ba177..75b3c5b4f24 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -46,6 +46,7 @@ typedef struct PaintWavePoint { float height; float velocity; + float brush_isect; short state; } PaintWavePoint; @@ -82,6 +83,7 @@ void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char* #define DPAINT_PAINT_NEW 2 /* PaintWavePoint state */ +#define DPAINT_WAVE_ISECT_CHANGED -1 #define DPAINT_WAVE_NONE 0 #define DPAINT_WAVE_OBSTACLE 1 #define DPAINT_WAVE_REFLECT_ONLY 2 diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 522aed439aa..7634d694150 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -98,7 +98,8 @@ static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1}; /* paint effect default movement per frame in global units */ #define EFF_MOVEMENT_PER_FRAME 0.05f /* initial wave time factor */ -#define WAVE_TIME_FAC 0.1 +#define WAVE_TIME_FAC (1.0f/24.f) +#define WAVE_INIT_SIZE 5.0f /* drying limits */ #define MIN_WETNESS 0.001f /* dissolve macro */ @@ -149,6 +150,7 @@ typedef struct PaintBakeData { int *s_num; /* num of realCoord samples */ Vec3f *realCoord; /* current pixel center world-space coordinates for each sample * ordered as (s_pos+s_num)*/ + Bounds3D mesh_bounds; /* adjacency info */ BakeNeighPoint *bNeighs; /* current global neighbour distances and directions, if required */ @@ -969,7 +971,7 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett surface->color_spread_speed = 1.0f; surface->shrink_speed = 1.0f; - surface->wave_damping = 0.05f; + surface->wave_damping = 0.04f; surface->wave_speed = 1.0f; surface->wave_timescale = 1.0f; surface->wave_spring = 0.20f; @@ -1037,6 +1039,7 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru brush->particle_radius = 0.2f; brush->particle_smooth = 0.05f; + brush->wave_type = MOD_DPAINT_WAVEB_CHANGE; brush->wave_factor = 1.0f; brush->wave_clamp = 0.0f; brush->smudge_strength = 0.3f; @@ -2070,7 +2073,6 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) PaintUVPoint *tempPoints = NULL; Vec3f *tempWeights = NULL; - /* MVert *mvert = NULL; */ /* UNUSED */ MFace *mface = NULL; MTFace *tface = NULL; Bounds2D *faceBB = NULL; @@ -2081,7 +2083,6 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats."); numOfFaces = dm->getNumFaces(dm); - /* mvert = dm->getVertArray(dm); */ /* UNUSED */ mface = dm->getFaceArray(dm); /* get uv layer */ @@ -2859,7 +2860,12 @@ static void dynamicPaint_mixPaintColors(DynamicPaintSurface *surface, int index, /* applies given brush intersection value for wave surface */ static void dynamicPaint_mixWaveHeight(PaintWavePoint *wPoint, DynamicPaintBrushSettings *brush, float isect_height) { + float isect_change = isect_height - wPoint->brush_isect; int hit = 0; + /* intersection marked regardless of brush type or hit */ + wPoint->brush_isect = isect_height; + wPoint->state = DPAINT_WAVE_ISECT_CHANGED; + isect_height *= brush->wave_factor; /* determine hit depending on wave_factor */ @@ -2878,6 +2884,10 @@ static void dynamicPaint_mixWaveHeight(PaintWavePoint *wPoint, DynamicPaintBrush wPoint->velocity = isect_height; else if (brush->wave_type == MOD_DPAINT_WAVEB_REFLECT) wPoint->state = DPAINT_WAVE_REFLECT_ONLY; + else if (brush->wave_type == MOD_DPAINT_WAVEB_CHANGE) { + if (isect_change < 0.0f) + wPoint->height += isect_change*brush->wave_factor; + } } } @@ -4292,6 +4302,9 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) float dt, min_dist, damp_factor; float wave_speed = surface->wave_speed; double average_dist = 0.0f; + Bounds3D *mb = &sData->bData->mesh_bounds; + float canvas_size = MAX3((mb->max[0]-mb->min[0]), (mb->max[1]-mb->min[1]), (mb->max[2]-mb->min[2])); + float wave_scale = WAVE_INIT_SIZE/canvas_size; /* allocate memory */ PaintWavePoint *prevPoint = MEM_mallocN(sData->total_points*sizeof(PaintWavePoint), "Temp previous points for wave simulation"); @@ -4307,11 +4320,11 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) average_dist += bNeighs[sData->adj_data->n_index[index]+i].dist; } } - average_dist /= sData->adj_data->total_targets; + average_dist *= wave_scale/sData->adj_data->total_targets; /* determine number of required steps */ steps = (int)ceil((WAVE_TIME_FAC*timescale*surface->wave_timescale) / (average_dist/wave_speed/3)); - CLAMP(steps, 1, 15); + CLAMP(steps, 1, 20); timescale /= steps; /* apply simulation values for final timescale */ @@ -4332,12 +4345,12 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) int numOfN = 0, numOfRN = 0; int i; - if (wPoint->state) continue; + if (wPoint->state > 0) continue; /* calculate force from surrounding points */ for (i=0; iadj_data->n_index[index]+i; - float dist = bNeighs[n_index].dist; + float dist = bNeighs[n_index].dist*wave_scale; PaintWavePoint *tPoint = &prevPoint[sData->adj_data->n_target[n_index]]; if (!dist || tPoint->state>0) continue; @@ -4381,6 +4394,10 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) #pragma omp parallel for schedule(static) for (index = 0; index < sData->total_points; index++) { PaintWavePoint *wPoint = &((PaintWavePoint*)sData->type_data)[index]; + /* if there wasnt any brush intersection, clear isect height */ + if (wPoint->state == DPAINT_WAVE_NONE) { + wPoint->brush_isect = 0.0f; + } wPoint->state = DPAINT_WAVE_NONE; } @@ -4594,10 +4611,11 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc /* * Make a transformed copy of canvas derived mesh vertices to avoid recalculation. */ - #pragma omp parallel for schedule(static) + bData->mesh_bounds.valid = 0; for (index=0; indexobmat, canvas_verts[index].v); + boundInsert(&bData->mesh_bounds, canvas_verts[index].v); } /* diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index 22a0462985c..fdfd1e2b754 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -169,6 +169,7 @@ typedef struct DynamicPaintCanvasSettings { #define MOD_DPAINT_WAVEB_DEPTH 0 /* use intersection depth */ #define MOD_DPAINT_WAVEB_FORCE 1 /* act as a force on intersection area */ #define MOD_DPAINT_WAVEB_REFLECT 2 /* obstacle that reflects waves */ +#define MOD_DPAINT_WAVEB_CHANGE 3 /* use change of intersection depth from previous frame */ /* brush ray_dir */ #define MOD_DPAINT_RAY_CANVAS 0 diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 10042f5392a..893993794ba 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -623,8 +623,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Damping", "Wave damping factor"); prop= RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 3.0); - RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2); + RNA_def_property_range(prop, 0.01, 5.0); + RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2); RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed"); prop= RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE); @@ -696,6 +696,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = { + {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""}, {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""}, {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""}, {MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""}, @@ -758,7 +759,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type); - RNA_def_property_ui_text(prop, "Brush Effect", ""); + RNA_def_property_ui_text(prop, "Wave Type", ""); prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -2.0, 2.0); From 9b17d39ce031cb89a3e4ea8cbdd0bceb4612871d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 16 Nov 2011 19:22:14 +0000 Subject: [PATCH 134/203] Fix #29260: Missing "Extend" parameter for Border Select Added "Extend" flag to border select operators for editors: - UV Editor - Sequencer - NLA - Info Space - Graph Editor - File Browser - Clip Editor - Action Editor - Channels and markers regions Can be used for custom keymaps. --- .../editors/animation/anim_channels_edit.c | 11 +++++++--- .../blender/editors/animation/anim_markers.c | 6 +++++- .../editors/space_action/action_select.c | 9 +++++++-- .../blender/editors/space_clip/tracking_ops.c | 16 ++++++++++----- source/blender/editors/space_file/file_ops.c | 11 ++++++++-- .../editors/space_graph/graph_select.c | 10 ++++++++-- .../blender/editors/space_info/info_report.c | 13 +++++++++++- source/blender/editors/space_nla/nla_select.c | 10 ++++++++-- .../blender/editors/space_node/node_select.c | 6 +++++- .../space_sequencer/sequencer_select.c | 7 ++++++- source/blender/editors/uvedit/uvedit_ops.c | 20 +++++++++++++++---- 11 files changed, 95 insertions(+), 24 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index b4a86e5d74c..8c699c840dc 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1917,7 +1917,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short selectmode=0; - int gesture_mode; + int gesture_mode, extend; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -1928,8 +1928,13 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) rect.ymin= RNA_int_get(op->ptr, "ymin"); rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); - + gesture_mode= RNA_int_get(op->ptr, "gesture_mode"); + extend= RNA_boolean_get(op->ptr, "extend"); + + if(!extend) + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR); + if (gesture_mode == GESTURE_MODAL_SELECT) selectmode = ACHANNEL_SETFLAG_ADD; else @@ -1963,7 +1968,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } /* ******************* Rename Operator ***************************** */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index aa1af231afd..cc1fae170d0 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1147,6 +1147,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) int xmax= RNA_int_get(op->ptr, "xmax"); int ymin= RNA_int_get(op->ptr, "ymin"); int ymax= RNA_int_get(op->ptr, "ymax"); + int extend= RNA_boolean_get(op->ptr, "extend"); UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf); UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf); @@ -1166,6 +1167,9 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) break; } } + else if (!extend) { + marker->flag &= ~SELECT; + } } WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -1198,7 +1202,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } /* *********************** (de)select all ***************** */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index f717b827a7e..1382d58482d 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -269,11 +269,16 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short mode=0, selectmode=0; - int gesture_mode; + int gesture_mode, extend; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + + /* clear all selection if not extending selection */ + extend= RNA_boolean_get(op->ptr, "extend"); + if (!extend) + deselect_action_keys(&ac, 1, SELECT_SUBTRACT); /* get settings from operator */ rect.xmin= RNA_int_get(op->ptr, "xmin"); @@ -330,7 +335,7 @@ void ACTION_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 7791e9f3e57..7ef7e69c143 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -869,7 +869,7 @@ static int border_select_exec(bContext *C, wmOperator *op) MovieTrackingTrack *track; rcti rect; rctf rectf; - int change= 0, mode; + int change= 0, mode, extend; /* get rectangle from operator */ rect.xmin= RNA_int_get(op->ptr, "xmin"); @@ -881,6 +881,7 @@ static int border_select_exec(bContext *C, wmOperator *op) ED_clip_point_stable_pos(C, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); mode= RNA_int_get(op->ptr, "gesture_mode"); + extend= RNA_boolean_get(op->ptr, "extend"); /* do actual selection */ track= clip->tracking.tracks.first; @@ -888,8 +889,13 @@ static int border_select_exec(bContext *C, wmOperator *op) if((track->flag&TRACK_HIDDEN)==0) { MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr); - if(MARKER_VISIBLE(sc, marker) && BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) { - BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT); + if(MARKER_VISIBLE(sc, marker)) { + if(BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) { + BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT); + } + else if(!extend) { + BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1); + } change= 1; } @@ -921,10 +927,10 @@ void CLIP_OT_select_border(wmOperatorType *ot) ot->poll= ED_space_clip_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } /********************** circle select operator *********************/ diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index d6bab41f719..69c192b077b 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -273,13 +273,20 @@ static int file_border_select_exec(bContext *C, wmOperator *op) ARegion *ar= CTX_wm_region(C); rcti rect; FileSelect ret; - + int extend= RNA_boolean_get(op->ptr, "extend"); short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); + rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); + if(!extend) { + SpaceFile *sfile= CTX_wm_space_file(C); + + file_deselect_all(sfile, SELECTED_FILE); + } + BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect); ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0); @@ -306,7 +313,7 @@ void FILE_OT_select_border(wmOperatorType *ot) ot->cancel= WM_border_select_cancel; /* rna */ - WM_operator_properties_gesture_border(ot, 0); + WM_operator_properties_gesture_border(ot, 1); } static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event) diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 9fb880e0bc6..2ba79ee230a 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -289,11 +289,17 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op) rcti rect; short mode=0, selectmode=0; short incl_handles; + int extend; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - + + /* clear all selection if not extending selection */ + extend= RNA_boolean_get(op->ptr, "extend"); + if (!extend) + deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, TRUE); + /* get select mode * - 'gesture_mode' from the operator specifies how to select * - 'include_handles' from the operator specifies whether to include handles in the selection @@ -354,7 +360,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria"); diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index eab6cb5402f..206639f064a 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -220,6 +220,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) ARegion *ar= CTX_wm_region(C); ReportList *reports= CTX_wm_reports(C); int report_mask= info_report_mask(sinfo); + int extend= RNA_boolean_get(op->ptr, "extend"); Report *report_min, *report_max, *report; //View2D *v2d= UI_view2d_fromcontext(C); @@ -244,6 +245,16 @@ static int borderselect_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax); */ + if(!extend) { + for(report= reports->list.first; report; report= report->next) { + + if((report->type & report_mask)==0) + continue; + + report->flag &= ~SELECT; + } + } + report_min= info_text_pick(sinfo, ar, reports, rect.ymax); report_max= info_text_pick(sinfo, ar, reports, rect.ymin); @@ -308,7 +319,7 @@ void INFO_OT_select_border(wmOperatorType *ot) /* ot->flag= OPTYPE_REGISTER; */ /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 49340b31b47..0cb48582bc9 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -282,11 +282,17 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short mode=0, selectmode=0; + int extend; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - + + /* clear all selection if not extending selection */ + extend= RNA_boolean_get(op->ptr, "extend"); + if (!extend) + deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT); + /* get settings from operator */ rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); @@ -341,7 +347,7 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, 0); + WM_operator_properties_gesture_border(ot, 1); RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 593beedc765..c863efada9f 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -164,6 +164,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf; int gesture_mode= RNA_int_get(op->ptr, "gesture_mode"); + int extend= RNA_boolean_get(op->ptr, "extend"); rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); @@ -180,6 +181,9 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) else node->flag &= ~SELECT; } + else if(!extend) { + node->flag &= ~SELECT; + } } node_sort(snode->edittree); @@ -228,7 +232,7 @@ void NODE_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture"); } diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index d749371a636..9eb900ed427 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -827,6 +827,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf, rq; short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); + int extend = RNA_boolean_get(op->ptr, "extend"); int mval[2]; if(ed==NULL) @@ -852,6 +853,10 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) else seq->flag &= ~SEQ_ALLSEL; recurs_sel_seq(seq); } + else if(!extend) { + seq->flag &= ~SEQ_ALLSEL; + recurs_sel_seq(seq); + } } WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); @@ -880,7 +885,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } /* ****** Selected Grouped ****** */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 173ab809b53..7fc878de3f9 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1490,7 +1490,7 @@ static void UV_OT_stitch(wmOperatorType *ot) /* ******************** (de)select all operator **************** */ -static int select_all_exec(bContext *C, wmOperator *op) +static void select_all_perform(bContext *C, int action) { Scene *scene; ToolSettings *ts; @@ -1499,7 +1499,6 @@ static int select_all_exec(bContext *C, wmOperator *op) EditFace *efa; Image *ima; MTFace *tf; - int action = RNA_enum_get(op->ptr, "action"); scene= CTX_data_scene(C); ts= CTX_data_tool_settings(C); @@ -1560,6 +1559,15 @@ static int select_all_exec(bContext *C, wmOperator *op) } } } +} + +static int select_all_exec(bContext *C, wmOperator *op) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); + int action= RNA_enum_get(op->ptr, "action"); + + select_all_perform(C, action); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); @@ -2275,7 +2283,7 @@ static int border_select_exec(bContext *C, wmOperator *op) MTFace *tface; rcti rect; rctf rectf; - int change, pinned, select, faces; + int change, pinned, select, faces, extend; /* get rectangle from operator */ rect.xmin= RNA_int_get(op->ptr, "xmin"); @@ -2289,6 +2297,10 @@ static int border_select_exec(bContext *C, wmOperator *op) /* figure out what to select/deselect */ select= (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); pinned= RNA_boolean_get(op->ptr, "pinned"); + extend= RNA_boolean_get(op->ptr, "extend"); + + if(!extend) + select_all_perform(C, SEL_DESELECT); if(ts->uv_flag & UV_SYNC_SELECTION) faces= (ts->selectmode == SCE_SELECT_FACE); @@ -2411,7 +2423,7 @@ static void UV_OT_select_border(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only"); - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, TRUE); } /* ******************** circle select operator **************** */ From 3dcc9aef9685388255d4cf9d646830d573aeb932 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 19:31:42 +0000 Subject: [PATCH 135/203] merge mempool changes from bmesh (adds mempool iterator). --- .../blenkernel/intern/BME_Customdata.c | 2 +- source/blender/blenkernel/intern/BME_mesh.c | 8 +- source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenlib/BLI_mempool.h | 45 +++++- source/blender/blenlib/intern/BLI_ghash.c | 2 +- source/blender/blenlib/intern/BLI_mempool.c | 141 +++++++++++++++--- source/blender/imbuf/intern/moviecache.c | 6 +- 7 files changed, 169 insertions(+), 37 deletions(-) diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index 8a6426eb3d5..67215b5e40f 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -86,7 +86,7 @@ void BME_CD_Create(BME_CustomData *data, BME_CustomDataInit *init, int initalloc if(data->totlayer){ /*alloc memory*/ data->layers = MEM_callocN(sizeof(BME_CustomDataLayer)*data->totlayer, "BMesh Custom Data Layers"); - data->pool = BLI_mempool_create(data->totsize, initalloc, initalloc, 0); + data->pool = BLI_mempool_create(data->totsize, initalloc, initalloc, FALSE, FALSE); /*initialize layer data*/ for(i=0; i < BME_CD_NUMTYPES; i++){ if(init->layout[i]){ diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index 1b5761fb94e..cda66de6f22 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -55,10 +55,10 @@ BME_Mesh *BME_make_mesh(int allocsize[4]) /*allocate the structure*/ BME_Mesh *bm = MEM_callocN(sizeof(BME_Mesh),"BMesh"); /*allocate the memory pools for the mesh elements*/ - bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], allocsize[0], 0); - bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], allocsize[1], 0); - bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], allocsize[2], 0); - bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], allocsize[3], 0); + bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], allocsize[0], FALSE, FALSE); + bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], allocsize[1], FALSE, FALSE); + bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], allocsize[2], FALSE, FALSE); + bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], allocsize[3], FALSE, FALSE); return bm; } /* diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index d7cc5376e21..9cbed451c09 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2009,7 +2009,7 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData void CustomData_bmesh_init_pool(CustomData *data, int allocsize){ - if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, 0); + if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE); } void CustomData_bmesh_free_block(CustomData *data, void **block) diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 2a81966986f..f98919fadd3 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -34,12 +34,45 @@ * \brief Simple fast memory allocator. */ -struct BLI_mempool; +#ifdef __cplusplus +extern "C" +{ +#endif -struct BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmalloc); -void *BLI_mempool_alloc(struct BLI_mempool *pool); -void *BLI_mempool_calloc(struct BLI_mempool *pool); -void BLI_mempool_free(struct BLI_mempool *pool, void *addr); -void BLI_mempool_destroy(struct BLI_mempool *pool); +struct BLI_mempool; +struct BLI_mempool_chunk; + +typedef struct BLI_mempool BLI_mempool; + +/*allow_iter allows iteration on this mempool. note: this requires that the + first four bytes of the elements never contain the character string + 'free'. use with care.*/ + +BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, + short use_sysmalloc, short allow_iter); +void *BLI_mempool_alloc(BLI_mempool *pool); +void *BLI_mempool_calloc(BLI_mempool *pool); +void BLI_mempool_free(BLI_mempool *pool, void *addr); +void BLI_mempool_destroy(BLI_mempool *pool); +int BLI_mempool_count(BLI_mempool *pool); + +/** iteration stuff. note: this may easy to produce bugs with **/ +/*private structure*/ +typedef struct BLI_mempool_iter { + BLI_mempool *pool; + struct BLI_mempool_chunk *curchunk; + int curindex; +} BLI_mempool_iter; + +/*allow iteration on this mempool. note: this requires that the + first four bytes of the elements never contain the character string + 'free'. use with care.*/ +void BLI_mempool_allow_iter(BLI_mempool *pool); +void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter); +void *BLI_mempool_iterstep(BLI_mempool_iter *iter); + +#ifdef __cplusplus +} +#endif #endif diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 080dc77fc06..c1894088300 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -60,7 +60,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { GHash *gh= MEM_mallocN(sizeof(*gh), info); gh->hashfp= hashfp; gh->cmpfp= cmpfp; - gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0); + gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, FALSE, FALSE); gh->cursize= 0; gh->nentries= 0; diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 7e79b9f65a1..4e37ac05214 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -20,7 +20,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Geoffery Bantle * * ***** END GPL LICENSE BLOCK ***** */ @@ -29,18 +29,36 @@ * \ingroup bli */ - /* - Simple, fast memory allocator for allocating many elements of the same size. -*/ + * Simple, fast memory allocator for allocating many elements of the same size. + */ + +#include "BLI_utildefines.h" +#include "BLI_listbase.h" + +#include "BLI_mempool.h" /* own include */ + +#include "DNA_listBase.h" #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" -#include "BLI_mempool.h" -#include + +#include +#include + +/* note: copied from BKE_utildefines.h, dont use here because we're in BLI */ +#ifdef __BIG_ENDIAN__ +/* Big Endian */ +# define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) ) +#else +/* Little Endian */ +# define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) ) +#endif + +#define FREEWORD MAKE_ID('f', 'r', 'e', 'e') typedef struct BLI_freenode { struct BLI_freenode *next; + int freeword; /* used to identify this as a freed node */ } BLI_freenode; typedef struct BLI_mempool_chunk { @@ -50,33 +68,42 @@ typedef struct BLI_mempool_chunk { typedef struct BLI_mempool { struct ListBase chunks; - int esize, csize, pchunk; /*size of elements and chunks in bytes and number of elements per chunk*/ - struct BLI_freenode *free; /*free element list. Interleaved into chunk datas.*/ - int totalloc, totused; /*total number of elements allocated in total, and currently in use*/ - int use_sysmalloc; + int esize, csize, pchunk; /* size of elements and chunks in bytes + * and number of elements per chunk*/ + short use_sysmalloc, allow_iter; + /* keeps aligned to 16 bits */ + + BLI_freenode *free; /* free element list. Interleaved into chunk datas.*/ + int totalloc, totused; /* total number of elements allocated in total, + * and currently in use*/ } BLI_mempool; -BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmalloc) +#define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2) + +BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, + short use_sysmalloc, short allow_iter) { BLI_mempool *pool = NULL; BLI_freenode *lasttail = NULL, *curnode = NULL; int i,j, maxchunks; char *addr; - - if (esize < sizeof(void*)) - esize = sizeof(void*); - + + if (esize < MEMPOOL_ELEM_SIZE_MIN) + esize = MEMPOOL_ELEM_SIZE_MIN; + /*allocate the pool structure*/ pool = use_sysmalloc ? malloc(sizeof(BLI_mempool)) : MEM_mallocN(sizeof(BLI_mempool), "memory pool"); - pool->esize = esize; + pool->esize = allow_iter ? MAX2(esize, sizeof(BLI_freenode)) : esize; pool->use_sysmalloc = use_sysmalloc; pool->pchunk = pchunk; pool->csize = esize * pchunk; pool->chunks.first = pool->chunks.last = NULL; pool->totused= 0; + pool->allow_iter= allow_iter; maxchunks = tote / pchunk + 1; - + if (maxchunks==0) maxchunks = 1; + /*allocate the actual chunks*/ for (i=0; i < maxchunks; i++) { BLI_mempool_chunk *mpchunk = use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); @@ -84,15 +111,30 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmall mpchunk->data = use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI Mempool Chunk Data"); BLI_addtail(&(pool->chunks), mpchunk); - if (i==0) pool->free = mpchunk->data; /*start of the list*/ + if (i==0) { + pool->free = mpchunk->data; /*start of the list*/ + if (pool->allow_iter) + pool->free->freeword = FREEWORD; + } + /*loop through the allocated data, building the pointer structures*/ for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) { curnode = ((BLI_freenode*)addr); addr += pool->esize; curnode->next = (BLI_freenode*)addr; + if (pool->allow_iter) { + if (j != pool->pchunk-1) + curnode->next->freeword = FREEWORD; + curnode->freeword = FREEWORD; + } } /*final pointer in the previously allocated chunk is wrong.*/ - if (lasttail) lasttail->next = mpchunk->data; + if (lasttail) { + lasttail->next = mpchunk->data; + if (pool->allow_iter) + lasttail->freeword = FREEWORD; + } + /*set the end of this chunks memoryy to the new tail for next iteration*/ lasttail = curnode; @@ -121,10 +163,18 @@ void *BLI_mempool_alloc(BLI_mempool *pool) BLI_addtail(&(pool->chunks), mpchunk); pool->free = mpchunk->data; /*start of the list*/ - for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) { + if (pool->allow_iter) + pool->free->freeword = FREEWORD; + for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){ curnode = ((BLI_freenode*)addr); addr += pool->esize; curnode->next = (BLI_freenode*)addr; + + if (pool->allow_iter) { + curnode->freeword = FREEWORD; + if (j != pool->pchunk-1) + curnode->next->freeword = FREEWORD; + } } curnode->next = NULL; /*terminate the list*/ @@ -132,6 +182,9 @@ void *BLI_mempool_alloc(BLI_mempool *pool) } retval = pool->free; + if (pool->allow_iter) + pool->free->freeword = 0x7FFFFFFF; + pool->free = pool->free->next; //memset(retval, 0, pool->esize); return retval; @@ -149,6 +202,8 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) { BLI_freenode *newhead = addr; + if (pool->allow_iter) + newhead->freeword = FREEWORD; newhead->next = pool->free; pool->free = newhead; @@ -185,6 +240,50 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) } } +void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) +{ + if (!pool->allow_iter) { + fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__); + iter->curchunk = NULL; + iter->curindex = 0; + + return; + } + + iter->pool = pool; + iter->curchunk = pool->chunks.first; + iter->curindex = 0; +} + +static void *bli_mempool_iternext(BLI_mempool_iter *iter) +{ + void *ret = NULL; + + if (!iter->curchunk || !iter->pool->totused) return NULL; + + ret = ((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex; + + iter->curindex++; + + if (iter->curindex >= iter->pool->pchunk) { + iter->curchunk = iter->curchunk->next; + iter->curindex = 0; + } + + return ret; +} + +void *BLI_mempool_iterstep(BLI_mempool_iter *iter) +{ + BLI_freenode *ret; + + do { + ret = bli_mempool_iternext(iter); + } while (ret && ret->freeword == FREEWORD); + + return ret; +} + void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk=NULL; diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index 41169a1c211..b19b88248f4 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -204,9 +204,9 @@ struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashC MovieCache *cache; cache= MEM_callocN(sizeof(MovieCache), "MovieCache"); - cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, 0); - cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, 0); - cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, 0); + cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, FALSE, FALSE); + cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, FALSE, FALSE); + cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, FALSE, FALSE); cache->hash= BLI_ghash_new(moviecache_hashhash, moviecache_hashcmp, "MovieClip ImBuf cache hash"); cache->keysize= keysize; From 819d1f417d2fb61719771d20b4999831dd24ca03 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 16 Nov 2011 20:03:54 +0000 Subject: [PATCH 136/203] Fix [#29190] VSE bugs. Only real bug was, that effect strips' start frame and length were editable. Made all four frame properties readonly on RNA level for those kind of strips (those for which get_sequence_effect_num_inputs returns a non-null value). Also fixed the tooltip of frame_final_duration. --- source/blender/blenkernel/intern/sequencer.c | 3 +++ source/blender/makesrna/intern/rna_sequencer.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 53878176fec..5d35867d9c3 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -594,6 +594,9 @@ void calc_sequence(Scene *scene, Sequence *seq) // seq->enddisp= MIN2(seq->seq1->enddisp, seq->seq2->enddisp); if (seq->seq1) { + /* XXX These resets should not be necessary, but users used to be able to + * edit effect's length, leading to strange results. See #29190. */ + seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp); seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp); /* we cant help if strips don't overlap, it wont give useful results. diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index f3b158f84fe..4db23443895 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -191,6 +191,13 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr) return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0); } +static int rna_Sequence_frame_editable(PointerRNA *ptr) +{ + Sequence *seq = (Sequence*)ptr->data; + /* Effect sequences' start frame and length must be readonly! */ + return (get_sequence_effect_num_inputs(seq->type))? 0: PROP_EDITABLE; +} + static void rna_Sequence_channel_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; @@ -1025,8 +1032,9 @@ static void rna_def_sequence(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME); RNA_def_property_range(prop, 1, MAXFRAME); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied"); + RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied"); RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set",NULL); + RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME); @@ -1040,6 +1048,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Start Frame", ""); RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp + RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME); @@ -1047,6 +1056,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivalent to moving the handle, not the actual start frame"); RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); // overlap tests and calc_seq_disp + RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME); @@ -1054,6 +1064,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied"); RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); // overlap tests and calc_seq_disp + RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME); From 7fbf5fbe8752c37ce61495e812d76065a6b9bc14 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 16 Nov 2011 20:36:06 +0000 Subject: [PATCH 137/203] UI: editor splitting widgets in corners now draw antialiased, also fix 1 pixel inconsistency between bottom-left and top-right. --- source/blender/editors/screen/area.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index e6ae8698b14..6a93e39a662 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -169,8 +169,13 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) static void area_draw_azone(short x1, short y1, short x2, short y2) { - int dx= floor(0.3f*(x2-x1)); - int dy= floor(0.3f*(y2-y1)); + int dx = x2 - x1; + int dy = y2 - y1; + + dx= copysign(ceil(0.3f*fabs(dx)), dx); + dy= copysign(ceil(0.3f*fabs(dy)), dy); + + glEnable(GL_LINE_SMOOTH); glColor4ub(255, 255, 255, 180); fdrawline(x1, y2, x2, y1); @@ -185,8 +190,9 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) fdrawline(x1, y2-dy+1, x2-dx+1, y1); glColor4ub(0, 0, 0, 150); fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1); -} + glDisable(GL_LINE_SMOOTH); +} static void region_draw_azone_icon(AZone *az) { @@ -550,19 +556,19 @@ static void area_azone_initialize(ScrArea *sa) az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); BLI_addtail(&(sa->actionzones), az); az->type= AZONE_AREA; - az->x1= sa->totrct.xmin; - az->y1= sa->totrct.ymin; - az->x2= sa->totrct.xmin + AZONESPOT; - az->y2= sa->totrct.ymin + AZONESPOT; + az->x1= sa->totrct.xmin - 1; + az->y1= sa->totrct.ymin - 1; + az->x2= sa->totrct.xmin + (AZONESPOT-1); + az->y2= sa->totrct.ymin + (AZONESPOT-1); BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); BLI_addtail(&(sa->actionzones), az); az->type= AZONE_AREA; - az->x1= sa->totrct.xmax+1; - az->y1= sa->totrct.ymax+1; - az->x2= sa->totrct.xmax-AZONESPOT; - az->y2= sa->totrct.ymax-AZONESPOT; + az->x1= sa->totrct.xmax + 1; + az->y1= sa->totrct.ymax + 1; + az->x2= sa->totrct.xmax - (AZONESPOT-1); + az->y2= sa->totrct.ymax - (AZONESPOT-1); BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); } From 68fa959de56f09f2dd575408699e4284eac77857 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 16 Nov 2011 22:20:17 +0000 Subject: [PATCH 138/203] BLI_mempool redefined causing compile time error, removing duplicate typedef --- source/blender/blenlib/intern/BLI_mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 4e37ac05214..19ae89da8ea 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -66,7 +66,7 @@ typedef struct BLI_mempool_chunk { void *data; } BLI_mempool_chunk; -typedef struct BLI_mempool { +struct BLI_mempool { struct ListBase chunks; int esize, csize, pchunk; /* size of elements and chunks in bytes * and number of elements per chunk*/ @@ -76,7 +76,7 @@ typedef struct BLI_mempool { BLI_freenode *free; /* free element list. Interleaved into chunk datas.*/ int totalloc, totused; /* total number of elements allocated in total, * and currently in use*/ -} BLI_mempool; +}; #define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2) From 1cfbde0eb469f7d827b73667d7406eddc0065ceb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 04:05:54 +0000 Subject: [PATCH 139/203] pass encoding to uses of decode() incase the default isnt utf-8. ignore decode errors in some cases. This should fix an error with generated qtcreator projects. also replace decoded bytes for unicode escape sequences in the VIEW3D_MT_edit_text_chars menu. --- build_files/cmake/project_info.py | 4 ++- build_files/cmake/project_source_info.py | 4 +-- doc/manpage/blender.1.py | 4 +-- doc/python_api/sphinx_doc_gen.py | 2 +- release/scripts/startup/bl_ui/space_view3d.py | 34 +++++++++---------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 0b922979a63..7162b324f94 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -224,7 +224,9 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"): import subprocess info = subprocess.Popen(["svn", "info", path], - stdout=subprocess.PIPE).communicate()[0].decode() + stdout=subprocess.PIPE).communicate()[0] + # string version, we only want the URL + info = info.decode(encoding="utf-8", errors="ignore") for l in info.split("\n"): l = l.strip() diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index 5d646eea2c1..d4b48ccd859 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -73,7 +73,7 @@ def do_ignore(filepath, ignore_prefix_list): def makefile_log(): import subprocess import time - # Check blender is not 2.5x until it supports playback again + print("running make with --dry-run ...") process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"], stdout=subprocess.PIPE, @@ -85,7 +85,7 @@ def makefile_log(): out = process.stdout.read() process.stdout.close() print("done!", len(out), "bytes") - return out.decode("ascii").split("\n") + return out.decode("utf-8", errors="ignore").split("\n") def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None): diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index 21df42a4082..0d43daccc5e 100644 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -52,9 +52,9 @@ else: cmd = [blender_bin, "--help"] print(" executing:", " ".join(cmd)) -blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode() +blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8") -blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip() +blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8").strip() blender_version = blender_version.split("Build")[0] date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y") diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 9cbd6824bbb..fc17b9a24a5 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -658,7 +658,7 @@ def pycontext2sphinx(BASEPATH): char_array = c_char_p_p.from_address(attr) i = 0 while char_array[i] is not None: - member = ctypes.string_at(char_array[i]).decode() + member = ctypes.string_at(char_array[i]).decode(encoding="ascii") fw(".. data:: %s\n\n" % member) member_type, is_seq = type_map[member] fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type)) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6bf8dd82c9b..a2a4405f77a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1830,32 +1830,32 @@ class VIEW3D_MT_edit_text_chars(Menu): def draw(self, context): layout = self.layout - layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode() - layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode() + layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00A9" + layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = "\u00AE" layout.separator() - layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode() - layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode() - layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode() - layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode() - layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode() - layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode() - layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode() - layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode() - layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode() + layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u00B0" + layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = "\u00D7" + layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A" + layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "\u00B9" + layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "\u00B2" + layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "\u00B3" + layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00BB" + layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00AB" + layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2030" layout.separator() - layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode() - layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode() - layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode() + layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\u00A4" + layout.operator("font.text_insert", text="British Pound|Alt L").text = "\u00A3" + layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\u00A5" layout.separator() - layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode() - layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode() - layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode() + layout.operator("font.text_insert", text="German S|Alt S").text = "\u00DF" + layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = "\u00BF" + layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = "\u00A1" class VIEW3D_MT_edit_meta(Menu): From db44a92a11bc1dff94f8aa162c19429a1fdafa5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 07:08:09 +0000 Subject: [PATCH 140/203] pydrivers: 'frame' is now in the driver namespace, - no need to link to scenes when using a frame from the pydriver, this made linking rigs for eg, quite messy. - advantage that we get subframe values (where scenes from was fixed to a whole number). --- source/blender/blenkernel/intern/fcurve.c | 8 +++-- .../editors/interface/interface_anim.c | 19 +--------- source/blender/python/BPY_extern.h | 2 +- source/blender/python/intern/bpy_driver.c | 35 ++++++++++++++++++- source/blender/python/intern/bpy_driver.h | 2 +- .../bad_level_call_stubs/stubs.c | 2 +- 6 files changed, 43 insertions(+), 25 deletions(-) diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 5ab997d2c54..4bb9dc47fda 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1576,7 +1576,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar) * - "evaltime" is the frame at which F-Curve is being evaluated * - has to return a float value */ -static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime)) +static float evaluate_driver (ChannelDriver *driver, const float evaltime) { DriverVar *dvar; @@ -1663,8 +1663,10 @@ static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime)) /* this evaluates the expression using Python,and returns its result: * - on errors it reports, then returns 0.0f */ - driver->curval= BPY_driver_exec(driver); + driver->curval= BPY_driver_exec(driver, evaltime); } +#else /* WITH_PYTHON*/ + (void)evaltime; #endif /* WITH_PYTHON*/ } break; @@ -2087,7 +2089,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime) /* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime") * Note: this is also used for drivers */ -float evaluate_fcurve (FCurve *fcu, float evaltime) +float evaluate_fcurve (FCurve *fcu, float evaltime) { float cvalue= 0.0f; float devaltime; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 1edd43d4e01..5e095bae922 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -164,24 +164,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) /* set the expression */ // TODO: need some way of identifying variables used BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); - - /* FIXME: for now, assume that - * - for expressions, users are likely to be using "frame" -> current frame" as a variable - * - driver_add_new_variable() adds a single-prop variable by default - */ - { - DriverVar *dvar; - DriverTarget *dtar; - - dvar = driver_add_new_variable(driver); - BLI_strncpy(dvar->name, "frame", sizeof(dvar->name)); - - dtar = &dvar->targets[0]; - dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first? - dtar->idtype= ID_SCE; - dtar->rna_path = BLI_sprintfN("frame_current"); - } - + /* updates */ driver->flag |= DRIVER_FLAG_RECOMPILE; WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME, NULL); diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 29e0185c2f2..51f9063c289 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -74,7 +74,7 @@ void BPY_modules_load_user(struct bContext *C); void BPY_app_handlers_reset(const short do_all); void BPY_driver_reset(void); -float BPY_driver_exec(struct ChannelDriver *driver); +float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime); int BPY_button_exec(struct bContext *C, const char *expr, double *value, const short verbose); int BPY_string_exec(struct bContext *C, const char *expr); diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 12fb5ed43b4..2aad4d8f2fe 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -91,6 +91,29 @@ int bpy_pydriver_create_dict(void) return 0; } +/* note, this function should do nothing most runs, only when changing frame */ +static PyObject *bpy_pydriver_InternStr__frame= NULL; + +static void bpy_pydriver_update_dict(const float evaltime) +{ + /* not thread safe but neither is python */ + static float evaltime_prev= FLT_MAX; + + if (evaltime_prev != evaltime) { + + /* currently only update the frame */ + if (bpy_pydriver_InternStr__frame == NULL) { + bpy_pydriver_InternStr__frame= PyUnicode_FromString("frame"); + } + + PyDict_SetItem(bpy_pydriver_Dict, + bpy_pydriver_InternStr__frame, + PyFloat_FromDouble(evaltime)); + + evaltime_prev= evaltime; + } +} + /* Update function, it gets rid of pydrivers global dictionary, forcing * BPY_driver_exec to recreate it. This function is used to force * reloading the Blender text module "pydrivers.py", if available, so @@ -110,6 +133,11 @@ void BPY_driver_reset(void) bpy_pydriver_Dict= NULL; } + if (bpy_pydriver_InternStr__frame) { + Py_DECREF(bpy_pydriver_InternStr__frame); + bpy_pydriver_InternStr__frame= NULL; + } + if (use_gil) PyGILState_Release(gilstate); @@ -139,7 +167,7 @@ static void pydriver_error(ChannelDriver *driver) * now release the GIL on python operator execution instead, using * PyEval_SaveThread() / PyEval_RestoreThread() so we dont lock up blender. */ -float BPY_driver_exec(ChannelDriver *driver) +float BPY_driver_exec(ChannelDriver *driver, const float evaltime) { PyObject *driver_vars=NULL; PyObject *retval= NULL; @@ -183,6 +211,10 @@ float BPY_driver_exec(ChannelDriver *driver) } } + /* update global namespace */ + bpy_pydriver_update_dict(evaltime); + + if (driver->expr_comp==NULL) driver->flag |= DRIVER_FLAG_RECOMPILE; @@ -246,6 +278,7 @@ float BPY_driver_exec(ChannelDriver *driver) } } + #if 0 // slow, with this can avoid all Py_CompileString above. /* execute expression to get a value */ retval= PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars); diff --git a/source/blender/python/intern/bpy_driver.h b/source/blender/python/intern/bpy_driver.h index 3e38cacf6d1..802a3649e20 100644 --- a/source/blender/python/intern/bpy_driver.h +++ b/source/blender/python/intern/bpy_driver.h @@ -33,7 +33,7 @@ int bpy_pydriver_create_dict(void); extern PyObject *bpy_pydriver_Dict; /* externals */ -float BPY_driver_exec(struct ChannelDriver *driver); +float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime); void BPY_driver_reset(void); #endif // BPY_DRIVER_H diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index abc5307b9f6..b299de0d897 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -454,7 +454,7 @@ void BPY_text_free_code(struct Text *text) {} void BPY_id_release(struct Text *text) {} int BPY_context_member_get(struct Context *C, const char *member, struct bContextDataResult *result) { return 0; } void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct) {} -float BPY_driver_exec(struct ChannelDriver *driver) {return 0.0f;} /* might need this one! */ +float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime) {return 0.0f;} /* might need this one! */ void BPY_DECREF(void *pyob_ptr) {} void BPY_pyconstraint_exec(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets) {} void macro_wrapper(struct wmOperatorType *ot, void *userdata) {} ; From 096f7c06b111df6e4ee5370f27921681a56b53b6 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Thu, 17 Nov 2011 08:02:36 +0000 Subject: [PATCH 141/203] Fixed comment in BLI_dlrbTree_search_exact --- source/blender/blenlib/intern/DLRB_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index 72743e38d4c..4507d70e339 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -209,7 +209,7 @@ DLRBT_Node *BLI_dlrbTree_search_exact (DLRBT_Tree *tree, DLRBT_Comparator_FP cmp } } - /* return the nearest matching node */ + /* return the exactly matching node */ return (found == 1) ? (node) : (NULL); } From 92ed90d2fac4b62d242987542a58adb75e80966a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 08:47:34 +0000 Subject: [PATCH 142/203] pyapi feature from 2.4x allow collection subscript to contain the library or None. eg: bpy.data.objects["Mesh", "/subsurf_test.blend"] bpy.data.scenes["Scene", None] # also works with get() bpy.data.armatures.get(("some_armature", "//some_lib.blend"), None) --- source/blender/python/intern/bpy_rna.c | 107 ++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 4 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index f1916355971..3bde38d1445 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -64,6 +64,7 @@ #include "MEM_guardedalloc.h" +#include "BKE_main.h" #include "BKE_idcode.h" #include "BKE_context.h" #include "BKE_global.h" /* evil G.* */ @@ -2096,6 +2097,84 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons } /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */ +/* special case: bpy.data.objects["some_id_name", "//some_lib_name.blend"] + * also for: bpy.data.objects.get(("some_id_name", "//some_lib_name.blend"), fallback) */ +static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject *key, const char *err_prefix, const short err_not_found) +{ + char *keyname; + + /* first validate the args, all we know is that they are a tuple */ + if (PyTuple_GET_SIZE(key) != 2) { + PyErr_Format(PyExc_KeyError, + "%s: tuple key must be a pair, not size %d", + err_prefix, PyTuple_GET_SIZE(key)); + return NULL; + } + else if (self->ptr.type != &RNA_BlendData) { + PyErr_Format(PyExc_KeyError, + "%s: is only valid for bpy.data collections, not %.200s", + err_prefix, RNA_struct_identifier(self->ptr.type)); + return NULL; + } + else if ((keyname= _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == NULL) { + PyErr_Format(PyExc_KeyError, + "%s: id must be a string, not %.200s", + err_prefix, Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name); + return NULL; + } + else { + PyObject *keylib= PyTuple_GET_ITEM(key, 1); + Library *lib; + PyObject *ret= NULL; + + if (keylib == Py_None) { + lib= NULL; + } + else if (PyUnicode_Check(keylib)) { + Main *bmain= self->ptr.data; + const char *keylib_str= _PyUnicode_AsString(keylib); + lib= BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name)); + if (lib == NULL) { + if (err_not_found) { + PyErr_Format(PyExc_KeyError, + "%s: lib name '%.240s' " + "does not reference a valid library", + err_prefix, keylib_str); + } + + return NULL; + } + } + else { + PyErr_Format(PyExc_KeyError, + "%s: lib must be a sting or None, not %.200s", + err_prefix, Py_TYPE(keylib)->tp_name); + return NULL; + } + + /* lib is either a valid poniter or NULL, + * either way can do direct comparison with id.lib */ + + RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) { + ID *id= itemptr.data; /* always an ID */ + if (id->lib == lib && (strncmp(keyname, id->name+2, sizeof(id->name)-2) == 0)) { + ret= pyrna_struct_CreatePyObject(&itemptr); + break; + } + } + RNA_PROP_END; + + /* we may want to fail silently as with collection.get() */ + if ((ret == NULL) && err_not_found) { + /* only runs for getitem access so use fixed string */ + PyErr_SetString(PyExc_KeyError, + "bpy_prop_collection[key, lib]: not found"); + } + + return ret; + } +} + static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop) { CollectionPropertyIterator rna_macro_iter; @@ -2266,6 +2345,10 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject } } } + else if (PyTuple_Check(key)) { + /* special case, for ID datablocks we */ + return pyrna_prop_collection_subscript_str_lib_pair(self, key, "bpy_prop_collection[id, lib]", TRUE); + } else { PyErr_Format(PyExc_TypeError, "bpy_prop_collection[key]: invalid key, " @@ -3915,6 +3998,7 @@ static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self) return PyLong_FromVoidPtr(self->ptr.data); } +/* TODO, get (string, lib) pair */ PyDoc_STRVAR(pyrna_prop_collection_get_doc, ".. method:: get(key, default=None)\n" "\n" @@ -3931,16 +4015,31 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args { PointerRNA newptr; - const char *key; + PyObject *key_ob; PyObject* def= Py_None; PYRNA_PROP_CHECK_OBJ(self); - if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) + if (!PyArg_ParseTuple(args, "O|O:get", &key_ob, &def)) return NULL; - if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) - return pyrna_struct_CreatePyObject(&newptr); + if (PyUnicode_Check(key_ob)) { + const char *key= _PyUnicode_AsString(key_ob); + + if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) + return pyrna_struct_CreatePyObject(&newptr); + } + else if (PyTuple_Check(key_ob)) { + PyObject *ret= pyrna_prop_collection_subscript_str_lib_pair(self, key_ob, "bpy_prop_collection.get((id, lib))", FALSE); + if (ret) { + return ret; + } + } + else { + PyErr_Format(PyExc_KeyError, + "bpy_prop_collection.get(key, ...): key must be a string or tuple, not %.200s", + Py_TYPE(key_ob)->tp_name); + } return Py_INCREF(def), def; } From d90e3759bcfdea5d7532dfc913dbec6b369f2904 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 18:23:34 +0000 Subject: [PATCH 143/203] centralize some of the came install commands, were being copied between osx/win/linux --- source/creator/CMakeLists.txt | 174 +++++++++++++++------------------- 1 file changed, 76 insertions(+), 98 deletions(-) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index c9c475a299e..ff82b836981 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -233,10 +233,6 @@ else() set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}) endif() - -# ----------------------------------------------------------------------------- -# Install Targets - set(BLENDER_TEXT_FILES ${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt @@ -244,8 +240,11 @@ set(BLENDER_TEXT_FILES ${CMAKE_SOURCE_DIR}/release/text/readme.html ) -if(UNIX AND NOT APPLE) +# ----------------------------------------------------------------------------- +# Platform Spesific Var: TARGETDIR_VER + +if(UNIX AND NOT APPLE) if(WITH_INSTALL_PORTABLE) set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION}) else() @@ -256,18 +255,60 @@ if(UNIX AND NOT APPLE) endif() endif() - # important to make a clean install each time - # else old scripts get loaded. - install( - CODE - "file(REMOVE_RECURSE ${TARGETDIR_VER})" - ) +elseif(WIN32) + set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION}) +elseif(APPLE) + set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}) + +endif() + + +# ----------------------------------------------------------------------------- +# Install Targets (Generic, All Platforms) + + +# important to make a clean install each time, else old scripts get loaded. +install( + CODE + "file(REMOVE_RECURSE ${TARGETDIR_VER})" +) + +if(WITH_PYTHON) + # install(CODE "message(\"copying blender scripts...\")") + install( + DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts + DESTINATION ${TARGETDIR_VER} + PATTERN ".svn" EXCLUDE + PATTERN "__pycache__" EXCLUDE + ) +endif() + +# localization +if(WITH_INTERNATIONAL) + install( + DIRECTORY + ${CMAKE_SOURCE_DIR}/release/datafiles/locale + ${CMAKE_SOURCE_DIR}/release/datafiles/fonts + DESTINATION ${TARGETDIR_VER}/datafiles + PATTERN ".svn" EXCLUDE + ) +endif() + +# helpful tip when using make +if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*") # message after building. add_custom_command( TARGET blender POST_BUILD MAIN_DEPENDENCY blender COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' ) +endif() + + +# ----------------------------------------------------------------------------- +# Install Targets (Platform Specific) + +if(UNIX AND NOT APPLE) # there are a few differences between portable and system install if(WITH_INSTALL_PORTABLE) @@ -348,16 +389,6 @@ if(UNIX AND NOT APPLE) ) endif() - if(WITH_INTERNATIONAL) - install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/release/datafiles/locale - ${CMAKE_SOURCE_DIR}/release/datafiles/fonts - DESTINATION ${TARGETDIR_VER}/datafiles - PATTERN ".svn" EXCLUDE - ) - endif() - # plugins in blender 2.5 don't work at the moment. # # install( @@ -367,14 +398,6 @@ if(UNIX AND NOT APPLE) # ) if(WITH_PYTHON) - # install(CODE "message(\"copying blender scripts...\")") - install( - DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts - DESTINATION ${TARGETDIR_VER} - PATTERN ".svn" EXCLUDE - PATTERN "__pycache__" EXCLUDE - ) - if(WITH_PYTHON_INSTALL) # Copy the systems python into the install directory # Scons copy in tools/Blender.py @@ -403,27 +426,12 @@ if(UNIX AND NOT APPLE) endif() elseif(WIN32) - set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION}) - - install( # same as linux!, deduplicate - CODE - "file(REMOVE_RECURSE ${TARGETDIR_VER})" - ) - - install( # same as linux!, deduplicate + install( FILES ${BLENDER_TEXT_FILES} DESTINATION ${TARGETDIR} ) - if(WITH_INTERNATIONAL) # same as linux!, deduplicate - install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/release/datafiles/locale - ${CMAKE_SOURCE_DIR}/release/datafiles/fonts - DESTINATION ${TARGETDIR_VER}/datafiles - PATTERN ".svn" EXCLUDE - ) - + if(WITH_INTERNATIONAL) install( FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll DESTINATION ${TARGETDIR} @@ -446,13 +454,6 @@ elseif(WIN32) # ) if(WITH_PYTHON) - # install(CODE "message(\"copying blender scripts...\")") - install( # same as linux!, deduplicate - DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts - DESTINATION ${TARGETDIR_VER} - PATTERN ".svn" EXCLUDE - PATTERN "__pycache__" EXCLUDE - ) install( FILES ${LIBDIR}/python/lib/python32.dll @@ -584,29 +585,6 @@ elseif(WIN32) endif() elseif(APPLE) - set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) - set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) - set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}) - - # setup Info.plist - execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) - - set_target_properties(blender PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") - - # important to make a clean install each time else old scripts get loaded. - install( - CODE - "file(REMOVE_RECURSE ${TARGETDIR_VER})" - ) - - # message after building. - add_custom_command( - TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' - ) # handy install macro to exclude files, we use \$ escape for the "to" # argument when calling so ${BUILD_TYPE} does not get expanded @@ -625,6 +603,17 @@ elseif(APPLE) ) endmacro() + set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) + + # setup Info.plist + execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + + set_target_properties(blender PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist + MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") + + # install release and app files install( FILES ${BLENDER_TEXT_FILES} @@ -632,26 +621,15 @@ elseif(APPLE) ) install( - FILES ${SOURCEDIR}/Contents/PkgInfo + FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo DESTINATION ${TARGETDIR}/blender.app/Contents ) install_dir( - ${SOURCEDIR}/Contents/Resources + ${OSX_APP_SOURCEDIR}/Contents/Resources \${TARGETDIR}/blender.app/Contents/ ) - # localization - if(WITH_INTERNATIONAL) - install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/release/datafiles/locale - ${CMAKE_SOURCE_DIR}/release/datafiles/fonts - DESTINATION ${TARGETDIR_VER}/datafiles - PATTERN ".svn" EXCLUDE - ) - endif() - # python if(WITH_PYTHON) # the python zip is first extract as part of the build process, @@ -678,18 +656,13 @@ elseif(APPLE) \${TARGETDIR_VER} ) - # copy scripts - install_dir( - ${CMAKE_SOURCE_DIR}/release/scripts - \${TARGETDIR_VER} - ) endif() # install blenderplayer bundle - copy of blender.app above. re-using macros et al # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it if(WITH_GAMEENGINE AND WITH_PLAYER) - set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) - set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist) + set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist) set(PLAYER_TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) @@ -700,12 +673,12 @@ elseif(APPLE) ) install( - FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo + FILES ${OSX_APP_PLAYER_SOURCEDIR}/Contents/PkgInfo DESTINATION ${TARGETDIR}/blenderplayer.app/Contents ) install_dir( - ${PLAYER_SOURCEDIR}/Contents/Resources + ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Resources \${TARGETDIR}/blenderplayer.app/Contents/ ) @@ -728,6 +701,11 @@ elseif(APPLE) endif() endif() +# ----------------------------------------------------------------------------- +# Generic Install, for all targets + + + # install more files specified elsewhere delayed_do_install(${TARGETDIR_VER}) From 22b5a3735fa124cd91910bb527688d664329bd4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 18:41:37 +0000 Subject: [PATCH 144/203] add flag FUNC_USE_MAIN for rna functions which don't need the context. (currently unused) --- source/blender/makesrna/RNA_types.h | 9 +++++---- source/blender/makesrna/intern/makesrna.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index e768594fe73..85869115e79 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -303,13 +303,14 @@ typedef struct ParameterDynAlloc { typedef enum FunctionFlag { FUNC_NO_SELF = 1, /* for static functions */ - FUNC_USE_CONTEXT = 2, - FUNC_USE_REPORTS = 4, + FUNC_USE_MAIN = 2, + FUNC_USE_CONTEXT = 4, + FUNC_USE_REPORTS = 8, FUNC_USE_SELF_ID = 2048, /* registering */ - FUNC_REGISTER = 8, - FUNC_REGISTER_OPTIONAL = 8|16, + FUNC_REGISTER = 16, + FUNC_REGISTER_OPTIONAL = 16|32, /* internal flags */ FUNC_BUILTIN = 128, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 6dbf7b9c553..c21685c9add 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1709,6 +1709,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA first= 0; } + if(func->flag & FUNC_USE_MAIN) { + if(!first) fprintf(f, ", "); + first= 0; + fprintf(f, "CTX_data_main(C)"); /* may have direct access later */ + } + if(func->flag & FUNC_USE_CONTEXT) { if(!first) fprintf(f, ", "); first= 0; @@ -2007,6 +2013,12 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA first= 0; } + if(func->flag & FUNC_USE_MAIN) { + if(!first) fprintf(f, ", "); + first= 0; + fprintf(f, "Main *bmain"); + } + if(func->flag & FUNC_USE_CONTEXT) { if(!first) fprintf(f, ", "); first= 0; From 14e103b8278e43ba5c8d01dbb055d5cd81799689 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 17 Nov 2011 19:26:50 +0000 Subject: [PATCH 145/203] Tweaks and fixes to UI messages, found while translating in french. --- source/blender/makesrna/intern/rna_actuator.c | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index db71dee26ce..b941e9ebed7 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -733,37 +733,37 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dloc[0]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force"); + RNA_def_property_ui_text(prop, "Max", "Upper limit for X force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[0]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Lower limit for X force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dloc[1]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force"); + RNA_def_property_ui_text(prop, "Max", "Upper limit for Y force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[1]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Lower limit for Y force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dloc[2]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force"); + RNA_def_property_ui_text(prop, "Max", "Upper limit for Z force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[2]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Lower limit for Z force"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* floats 3 Arrays*/ @@ -771,42 +771,42 @@ static void rna_def_object_actuator(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "dloc"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Loc", "Sets the location"); + RNA_def_property_ui_text(prop, "Loc", "Location"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "drot"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Rot", "Sets the rotation"); + RNA_def_property_ui_text(prop, "Rot", "Rotation"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "forceloc"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Force", "Sets the force"); + RNA_def_property_ui_text(prop, "Force", "Force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "forcerot"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Torque", "Sets the torque"); + RNA_def_property_ui_text(prop, "Torque", "Torque"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "linearvelocity"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Linear Velocity", "Sets the linear velocity (in Servo mode it sets the target relative linear velocity, it will be achieved by automatic application of force. Null velocity is a valid target)"); + RNA_def_property_ui_text(prop, "Linear Velocity", "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be achieved by automatic application of force - Null velocity is a valid target)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "angularvelocity"); RNA_def_property_array(prop, 3); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Angular Velocity", "Sets the angular velocity"); + RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* booleans */ @@ -902,14 +902,14 @@ static void rna_def_camera_actuator(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "damping"); RNA_def_property_range(prop, 0, 10.0); RNA_def_property_ui_range(prop, 0, 5.0, 1, 2); - RNA_def_property_ui_text(prop, "Damping", "Specify the strength of the constraint that drive the camera behind the target"); + RNA_def_property_ui_text(prop, "Damping", "Strength of the constraint that drives the camera behind the target"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* x/y */ prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "axis"); RNA_def_property_enum_items(prop, prop_axis_items); - RNA_def_property_ui_text(prop, "Axis", "Specify the axis the Camera will try to get behind"); + RNA_def_property_ui_text(prop, "Axis", "Axis the Camera will try to get behind"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -947,12 +947,12 @@ static void rna_def_sound_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_text(prop, "Volume", "Sets the initial volume of the sound"); + RNA_def_property_ui_text(prop, "Volume", "Initial volume of the sound"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2); - RNA_def_property_ui_text(prop, "Pitch", "Sets the pitch of the sound"); + RNA_def_property_ui_text(prop, "Pitch", "Pitch of the sound"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* floats - 3D Parameters */ @@ -989,7 +989,7 @@ static void rna_def_sound_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain"); RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); - RNA_def_property_ui_text(prop, "Cone Outer Gain", "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value and the normal gain in the inner cone"); + RNA_def_property_ui_text(prop, "Cone Outer Gain", "The gain outside the outer cone (the gain in the outer cone will be interpolated between this value and the normal gain in the inner cone)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE); @@ -1118,7 +1118,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, prop_direction_items); - RNA_def_property_ui_text(prop, "Direction", "Set the direction of the ray"); + RNA_def_property_ui_text(prop, "Direction", "Direction of the ray"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE); @@ -1150,7 +1150,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL); RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Range", "Set the maximum length of ray"); + RNA_def_property_ui_text(prop, "Range", "Maximum length of ray"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); @@ -1169,7 +1169,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) //XXX add magic property lookup prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "matprop"); - RNA_def_property_ui_text(prop, "Property", "Ray detect only Objects with this property"); + RNA_def_property_ui_text(prop, "Property", "Ray detects only Objects with this property"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE); @@ -1201,14 +1201,14 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); RNA_def_property_range(prop, 0.0, 180.0); - RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction (no correction is done if angle with target direction is between min and max)"); RNA_def_property_update(prop, NC_LOGIC, NULL); //XXX TODO - use radians internally then change to PROP_ANGLE prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); RNA_def_property_range(prop, 0.0, 180.0); - RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction (no correction is done if angle with target direction is between min and max)"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_CONST_TYPE_FH */ @@ -1310,7 +1310,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_sdna(prop, NULL, "ob"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (cant be on an visible layer)"); + RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (can't be on a visible layer)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE); @@ -1411,13 +1411,13 @@ static void rna_def_scene_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera. Leave empty to refer to self object"); + RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera (leave empty to refer to self object)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Scene"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Scene", "Set the Scene to be added/removed/paused/resumed"); + RNA_def_property_ui_text(prop, "Scene", "Scene to be added/removed/paused/resumed"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* XXX no need for those tooltips. to remove soon @@ -1462,7 +1462,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_ui_range(prop, 0, 1000, 1, 1); RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator. Use Python for more freedom (choose 0 for not random)"); + RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator, use Python for more freedom (choose 0 for not random)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); @@ -1491,7 +1491,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1. Success if you stay below this value"); + RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1, success if it's below this value"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_RANDOM_INT_CONST */ @@ -1505,13 +1505,13 @@ static void rna_def_random_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "int_arg_1"); RNA_def_property_range(prop, -1000, 1000); - RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range"); + RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "int_arg_2"); RNA_def_property_range(prop, -1000, 1000); - RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range"); + RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_RANDOM_INT_POISSON */ @@ -1532,26 +1532,26 @@ static void rna_def_random_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range"); + RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg_2"); RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range"); + RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_RANDOM_FLOAT_NORMAL */ prop= RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Mean", "A normal distribution. Mean of the distribution"); + RNA_def_property_ui_text(prop, "Mean", "A normal distribution: mean of the distribution"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg_2"); RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "SD", "A normal distribution. Standard deviation of the distribution"); + RNA_def_property_ui_text(prop, "SD", "A normal distribution: standard deviation of the distribution"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL */ @@ -1578,11 +1578,11 @@ static void rna_def_message_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "toPropName"); - RNA_def_property_ui_text(prop, "To", "Optional send message to objects with this name only, or empty to broadcast"); + RNA_def_property_ui_text(prop, "To", "Optional, send message to objects with this name only, or empty to broadcast"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Subject", "Optional message subject. This is what can be filtered on"); + RNA_def_property_ui_text(prop, "Subject", "Optional, message subject (this is what can be filtered on)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE); @@ -1593,7 +1593,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) /* ACT_MESG_MESG */ prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "body"); - RNA_def_property_ui_text(prop, "Body", "Optional message body Text"); + RNA_def_property_ui_text(prop, "Body", "Optional, message body Text"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_MESG_PROP */ @@ -1649,12 +1649,12 @@ static void rna_def_visibility_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE); - RNA_def_property_ui_text(prop, "Visible", "Set the objects visible. Initialized from the object render restriction toggle in physics button"); + RNA_def_property_ui_text(prop, "Visible", "Set the objects visible (initialized from the object render restriction toggle in physics button)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION); - RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it. Initialized from the object type in physics button"); + RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it (initialized from the object type in physics button)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE); @@ -1712,7 +1712,7 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg"); - RNA_def_property_ui_text(prop, "Value", "Set motion blur factor"); + RNA_def_property_ui_text(prop, "Value", "Motion blur factor"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1828,7 +1828,7 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack"); + RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE); @@ -1904,7 +1904,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "constraint"); - RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint you want to control"); + RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint to control"); RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -1923,7 +1923,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "weight"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Weight", "Set weight of this constraint"); + RNA_def_property_ui_text(prop, "Weight", "Weight of this constraint"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -1985,7 +1985,7 @@ static void rna_def_steering_actuator(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_sdna(prop, NULL, "target"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Target Object", "Set target object"); + RNA_def_property_ui_text(prop, "Target Object", "Target object"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "self_terminated", PROP_BOOLEAN, PROP_NONE); From 8c6057d5e3797478a2d62e37843ded7b8e84436e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 19:43:59 +0000 Subject: [PATCH 146/203] exclude addons_contrib/ for release builds. --- SConstruct | 5 +++++ build_files/scons/tools/btools.py | 4 ++-- source/creator/CMakeLists.txt | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index b5075aa4345..cd4e31efeff 100644 --- a/SConstruct +++ b/SConstruct @@ -70,6 +70,7 @@ BlenderEnvironment = Blender.BlenderEnvironment B = Blender VERSION = btools.VERSION # This is used in creating the local config directories +VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE ### globals ### platform = sys.platform @@ -524,6 +525,10 @@ if env['OURPLATFORM']!='darwin': if '__pycache__' in dn: # py3.2 cache dir dn.remove('__pycache__') + # only for testing builds + if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn: + dn.remove('addons_contrib') + dir = os.path.join(env['BF_INSTALLDIR'], VERSION) dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):] diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 856231e3c84..4c826b12e89 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -52,7 +52,7 @@ def get_version(): else: ver_display = "%s%s" % (ver_base, ver_char) # assume release - return ver_base, ver_display + return ver_base, ver_display, ver_cycle raise Exception("%s: missing version string" % fname) @@ -80,7 +80,7 @@ def checkEndian(): # This is used in creating the local config directories -VERSION, VERSION_DISPLAY = get_version() +VERSION, VERSION_DISPLAY, VERSION_RELEASE_CYCLE = get_version() REVISION = get_revision() ENDIAN = checkEndian() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index ff82b836981..fa68704c7cd 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -276,12 +276,23 @@ install( if(WITH_PYTHON) # install(CODE "message(\"copying blender scripts...\")") + + # exclude addons_contrib if release + if("${BLENDER_VERSION_CYCLE}" STREQUAL "release") + set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*") + else() + set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*") # dummy, wont do anything + endif() + install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts DESTINATION ${TARGETDIR_VER} PATTERN ".svn" EXCLUDE PATTERN "__pycache__" EXCLUDE + PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE ) + + unset(ADDON_EXCLUDE_CONDITIONAL) endif() # localization From e7f52d9953c6356c6595c0eaf7c91fa422fd7f60 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 20:11:20 +0000 Subject: [PATCH 147/203] addons in contrib now have their own 'Testing' category which is off by default. --- release/scripts/modules/addon_utils.py | 11 +++++++++-- release/scripts/startup/bl_ui/__init__.py | 10 +++++++--- .../scripts/startup/bl_ui/space_userpref.py | 18 ++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 26611fb93ad..1bd218ad92a 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -62,7 +62,7 @@ def modules(module_cache): path_list = paths() # fake module importing - def fake_module(mod_name, mod_path, speedy=True): + def fake_module(mod_name, mod_path, speedy=True, force_support=None): global error_encoding if _bpy.app.debug: @@ -134,6 +134,9 @@ def modules(module_cache): traceback.print_exc() raise + if force_support is not None: + mod.bl_info["support"] = force_support + return mod else: return None @@ -141,6 +144,10 @@ def modules(module_cache): modules_stale = set(module_cache.keys()) for path in path_list: + + # force all contrib addons to be 'TESTING' + force_support = 'TESTING' if path.endswith("addons_contrib") else None + for mod_name, mod_path in _bpy.path.module_names(path): modules_stale -= {mod_name} mod = module_cache.get(mod_name) @@ -161,7 +168,7 @@ def modules(module_cache): mod = None if mod is None: - mod = fake_module(mod_name, mod_path) + mod = fake_module(mod_name, mod_path, force_support=force_support) if mod: module_cache[mod_name] = mod diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 3db768f73fe..6aa08a7f50d 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -116,11 +116,15 @@ def register(): ) WindowManager.addon_support = EnumProperty( - items=[('OFFICIAL', "Official", ""), - ('COMMUNITY', 'Community', ""), + items=[('OFFICIAL', "Official", "Officially supported"), + ('COMMUNITY', "Community", "Maintained by community developers"), + ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"), ], name="Support", - description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'}) + description="Display support level", + default={'OFFICIAL', 'COMMUNITY'}, + options={'ENUM_FLAG'}, + ) # done... diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 665d790f832..c889e7f3de6 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -891,6 +891,12 @@ class USERPREF_PT_addons(Panel): bl_region_type = 'WINDOW' bl_options = {'HIDE_HEADER'} + _support_icon_mapping = { + 'OFFICIAL': 'FILE_BLEND', + 'COMMUNITY': 'POSE_DATA', + 'TESTING': 'MOD_EXPLODE', + } + @classmethod def poll(cls, context): userpref = context.user_preferences @@ -931,12 +937,13 @@ class USERPREF_PT_addons(Panel): split = layout.split(percentage=0.2) col = split.column() col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') - col.label(text="Categories") - col.prop(context.window_manager, "addon_filter", expand=True) col.label(text="Supported Level") col.prop(context.window_manager, "addon_support", expand=True) + col.label(text="Categories") + col.prop(context.window_manager, "addon_filter", expand=True) + col = split.column() # set in addon_utils.modules(...) @@ -995,12 +1002,7 @@ class USERPREF_PT_addons(Panel): rowsub.label(icon='ERROR') # icon showing support level. - if info["support"] == 'OFFICIAL': - rowsub.label(icon='FILE_BLEND') - elif info["support"] == 'COMMUNITY': - rowsub.label(icon='POSE_DATA') - else: - rowsub.label(icon='QUESTION') + rowsub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION')) if is_enabled: row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name From e9be8b4a0a840fc8aa18402b530a1e2f80683028 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Nov 2011 04:48:27 +0000 Subject: [PATCH 148/203] document py gotchas - dont assume you get the data names you ask for - beware of collisions with library names - beware of py modules calling sys.exit --- doc/python_api/rst/info_gotcha.rst | 97 +++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index b17debbb15c..70437e32553 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -223,6 +223,86 @@ While writing scripts that deal with armatures you may find you have to switch b This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode. +Data Names +========== + + +Naming Limitations +------------------ + +A common mistake is to assume newly created data is given the requested name. + +This can cause bugs when you add some data (normally imported) and then reference it later by name. + +.. code-block:: python + + bpy.data.meshes.new(name=meshid) + + # normally some code, function calls... + bpy.data.meshes[meshid] + + +Or with name assignment... + +.. code-block:: python + + obj.name = objname + + # normally some code, function calls... + obj = bpy.data.meshes[objname] + + +Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string. + + +Its better practice not to reference objects by names at all, once created you can store the data in a list, dictionary, on a class etc, there is rarely a reason to have to keep searching for the same data by name. + + +If you do need to use name references, its best to use a dictionary to maintain a mapping between the names of the imported assets and the newly created data, this way you don't run this risk of referencing existing data from the blend file, or worse modifying it. + +.. code-block:: python + + # typically declared in the main body of the function. + mesh_name_mapping = {} + + mesh = bpy.data.meshes.new(name=meshid) + mesh_name_mapping[meshid] = mesh + + # normally some code, or function calls... + + # use own dictionary rather then bpy.data + mesh = mesh_name_mapping[meshid] + + +Library Collisions +------------------ + +Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects, meshes, scenes etc the same thing by accident. + +However when linking in library data from another blend file naming collisions can occur, so its best to avoid referencing data by name at all. + +This can be tricky at times and not even blender handles this correctly in some case (when selecting the modifier object for eg you can't select between multiple objects with the same name), but its still good to try avoid problems in this area. + + +If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this. + +.. code-block:: python + + # typical name lookup, could be local or library. + obj = bpy.data.objects["my_obj"] + + # library object name look up using a pair + # where the second argument is the library path matching bpy.types.Library.filepath + obj = bpy.data.objects["my_obj", "//my_lib.blend"] + + # local object name look up using a pair + # where the second argument excludes library data from being returned. + obj = bpy.data.objects["my_obj", None] + + # both the examples above also works for 'get' + obj = bpy.data.objects.get(("my_obj", None)) + + Relative File Paths =================== @@ -230,12 +310,12 @@ Blenders relative file paths are not compatible with standard python modules suc Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path. -A common case where you would run into this problem is when exporting a material with assosiated image paths. +A common case where you would run into this problem is when exporting a material with associated image paths. >>> bpy.path.abspath(image.filepath) -When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`. +When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`. >>> bpy.path.abspath(image.filepath, library=image.library) @@ -289,7 +369,7 @@ Unicode encoding/decoding is a big topic with comprehensive python documentation * To print paths or to include them in the user interface use ``repr(path)`` first or ``"%r" % path`` with string formatting. -* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to deciede how to treat any strings you want to use with Blender, some importers do this. +* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to decide how to treat any strings you want to use with Blender, some importers do this. Strange errors using 'threading' module @@ -458,3 +538,14 @@ Removing Data **Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc. This is a problem in the API at the moment that we should eventually solve. + + +sys.exit +======== + +Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately. + +For example, the ``optparse`` module will print an error and exit if the arguments are invalid. + +An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice. + From c6c6a3578beae28a6c6c0164757ebbb694e7f816 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Nov 2011 04:55:43 +0000 Subject: [PATCH 149/203] tab -> spaces --- doc/python_api/rst/info_gotcha.rst | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index 70437e32553..281f0689044 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -147,7 +147,7 @@ Armature Bones in Blender have three distinct data structures that contain them. .. note:: - In the following examples ``bpy.context.object`` is assumed to be an armature object. + In the following examples ``bpy.context.object`` is assumed to be an armature object. Edit Bones @@ -163,11 +163,11 @@ This is only possible in edit mode. This will be empty outside of editmode. - >>> mybones = bpy.context.selected_editable_bones + >>> mybones = bpy.context.selected_editable_bones Returns an editbone only in edit mode. - >>> bpy.context.active_bone + >>> bpy.context.active_bone Bones (Object Mode) @@ -179,15 +179,15 @@ Example using :class:`bpy.types.Bone` in object or pose mode: Returns a bone (not an editbone) outside of edit mode - >>> bpy.context.active_bone + >>> bpy.context.active_bone This works, as with blender the setting can be edited in any mode - >>> bpy.context.object.data.bones["Bone"].use_deform = True + >>> bpy.context.object.data.bones["Bone"].use_deform = True Accessible but read-only - >>> tail = myobj.data.bones["Bone"].tail + >>> tail = myobj.data.bones["Bone"].tail Pose Bones @@ -199,20 +199,20 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode: .. code-block:: python - # Gets the name of the first constraint (if it exists) - bpy.context.object.pose.bones["Bone"].constraints[0].name + # Gets the name of the first constraint (if it exists) + bpy.context.object.pose.bones["Bone"].constraints[0].name - # Gets the last selected pose bone (pose mode only) - bpy.context.active_pose_bone + # Gets the last selected pose bone (pose mode only) + bpy.context.active_pose_bone .. note:: - Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses. + Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses. .. note:: - Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone` + Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone` Armature Mode Switching @@ -236,20 +236,20 @@ This can cause bugs when you add some data (normally imported) and then referenc .. code-block:: python - bpy.data.meshes.new(name=meshid) - - # normally some code, function calls... - bpy.data.meshes[meshid] + bpy.data.meshes.new(name=meshid) + + # normally some code, function calls... + bpy.data.meshes[meshid] Or with name assignment... .. code-block:: python - obj.name = objname - - # normally some code, function calls... - obj = bpy.data.meshes[objname] + obj.name = objname + + # normally some code, function calls... + obj = bpy.data.meshes[objname] Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string. @@ -262,16 +262,16 @@ If you do need to use name references, its best to use a dictionary to maintain .. code-block:: python - # typically declared in the main body of the function. - mesh_name_mapping = {} - - mesh = bpy.data.meshes.new(name=meshid) - mesh_name_mapping[meshid] = mesh - - # normally some code, or function calls... - - # use own dictionary rather then bpy.data - mesh = mesh_name_mapping[meshid] + # typically declared in the main body of the function. + mesh_name_mapping = {} + + mesh = bpy.data.meshes.new(name=meshid) + mesh_name_mapping[meshid] = mesh + + # normally some code, or function calls... + + # use own dictionary rather then bpy.data + mesh = mesh_name_mapping[meshid] Library Collisions From c63873ad220c2513072c80f03f7b647aafab3196 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Nov 2011 05:14:13 +0000 Subject: [PATCH 150/203] exclude addons_contrib for release builds for scons/osx too --- build_files/scons/tools/Blender.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 71a4af1dc36..4f447ce6240 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -34,6 +34,7 @@ import bcolors bc = bcolors.bcolors() import btools VERSION = btools.VERSION +VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE Split = SCons.Util.Split Action = SCons.Action.Action @@ -584,6 +585,10 @@ def AppIt(target=None, source=None, env=None): cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) + if VERSION_RELEASE_CYCLE == "release": + cmd = 'rm -rf %s/%s.app/Contents/MacOS/%s/scripts/addons_contrib'%(installdir,binary,VERSION) + commands.getoutput(cmd) + if env['WITH_BF_CYCLES']: croot = '%s/intern/cycles' % (bldroot) cinstalldir = '%s/%s.app/Contents/MacOS/%s/scripts/addons/cycles' % (installdir,binary,VERSION) From 9f0a6dca13c0debd27d7bd2a023e7d370c1374cd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 07:11:54 +0000 Subject: [PATCH 151/203] Added methods new and remove to scene.render.layers, so now render layers can be created and removed from scripts. --- source/blender/blenkernel/BKE_scene.h | 4 +- source/blender/blenkernel/intern/scene.c | 44 +++++++++++++++++-- source/blender/blenloader/intern/readfile.c | 2 +- .../blender/editors/render/render_shading.c | 29 ++---------- source/blender/makesrna/intern/rna_scene.c | 36 ++++++++++++++- 5 files changed, 82 insertions(+), 33 deletions(-) diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index ad394f9fb1a..7cb31505430 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -44,6 +44,7 @@ struct Main; struct Object; struct QuicktimeCodecData; struct RenderData; +struct SceneRenderLayer; struct Scene; struct Text; struct Text; @@ -93,7 +94,8 @@ void scene_clear_tagged(struct Main *bmain, struct Scene *sce); void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay); -void scene_add_render_layer(struct Scene *sce); +struct SceneRenderLayer *scene_add_render_layer(struct Scene *sce, const char *name); +int scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl); /* render profile */ int get_render_subsurf_level(struct RenderData *r, int level); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8b8c974cdc8..eefc5e09dbb 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -44,6 +44,7 @@ #include "DNA_anim_types.h" #include "DNA_group_types.h" +#include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -483,7 +484,7 @@ Scene *add_scene(const char *name) sce->r.osa= 8; /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */ - scene_add_render_layer(sce); + scene_add_render_layer(sce, NULL); /* game data */ sce->gm.stereoflag = STEREO_NOSTEREO; @@ -1086,13 +1087,16 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) } /* return default layer, also used to patch old files */ -void scene_add_render_layer(Scene *sce) +SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name) { SceneRenderLayer *srl; // int tot= 1 + BLI_countlist(&sce->r.layers); - + + if(!name) + name= "RenderLayer"; + srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer"); - strcpy(srl->name, "RenderLayer"); + strcpy(srl->name, name); BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(srl->name)); BLI_addtail(&sce->r.layers, srl); @@ -1100,6 +1104,38 @@ void scene_add_render_layer(Scene *sce) srl->lay= (1<<20) -1; srl->layflag= 0x7FFF; /* solid ztra halo edge strand */ srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z; + + return srl; +} + +int scene_remove_render_layer(Main *main, Scene *scene, SceneRenderLayer *srl) +{ + Scene *sce; + int act= BLI_findindex(&scene->r.layers, srl); + + if(BLI_countlist(&scene->r.layers) <= 1) + return 0; + + BLI_remlink(&scene->r.layers, srl); + MEM_freeN(srl); + + scene->r.actlay= 0; + + for(sce = main->scene.first; sce; sce = sce->id.next) { + if(sce->nodetree) { + bNode *node; + for(node = sce->nodetree->nodes.first; node; node = node->next) { + if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) { + if(node->custom1==act) + node->custom1= 0; + else if(node->custom1>act) + node->custom1--; + } + } + } + } + + return 1; } /* render simplification */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 79ab90d06fb..4a530be58db 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8947,7 +8947,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(sce->r.yparts<2) sce->r.yparts= 4; /* adds default layer */ if(sce->r.layers.first==NULL) - scene_add_render_layer(sce); + scene_add_render_layer(sce, NULL); else { SceneRenderLayer *srl; /* new layer flag for sky, was default for solid */ diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 80c54d970b4..e2e48a489b6 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -519,7 +519,7 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); - scene_add_render_layer(scene); + scene_add_render_layer(scene, NULL); scene->r.actlay= BLI_countlist(&scene->r.layers) - 1; WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); @@ -543,32 +543,11 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot) static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C), *sce; - SceneRenderLayer *rl; - int act= scene->r.actlay; + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay); - if(BLI_countlist(&scene->r.layers) <= 1) + if(!scene_remove_render_layer(CTX_data_main(C), scene, rl)) return OPERATOR_CANCELLED; - - rl= BLI_findlink(&scene->r.layers, scene->r.actlay); - BLI_remlink(&scene->r.layers, rl); - MEM_freeN(rl); - - scene->r.actlay= 0; - - for(sce = CTX_data_main(C)->scene.first; sce; sce = sce->id.next) { - if(sce->nodetree) { - bNode *node; - for(node = sce->nodetree->nodes.first; node; node = node->next) { - if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) { - if(node->custom1==act) - node->custom1= 0; - else if(node->custom1>act) - node->custom1--; - } - } - } - } WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2d3944a5b07..1bb184c9433 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -734,6 +734,25 @@ static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA valu if (index != -1) rd->actlay= index; } +static SceneRenderLayer *rna_RenderLayer_add(ID *id, RenderData *UNUSED(rd), const char *name) +{ + Scene *scene= (Scene *)id; + SceneRenderLayer *srl= scene_add_render_layer(scene, name); + + WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); + + return srl; +} + +static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, SceneRenderLayer *srl) +{ + Scene *scene= (Scene *)id; + + scene_remove_render_layer(bmain, scene, srl); + + WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); +} + static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) { RenderData *rd= (RenderData*)ptr->data; @@ -2186,8 +2205,8 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; PropertyRNA *prop; - // FunctionRNA *func; - // PropertyRNA *parm; + FunctionRNA *func; + PropertyRNA *parm; RNA_def_property_srna(cprop, "RenderLayers"); srna= RNA_def_struct(brna, "RenderLayers", NULL); @@ -2209,6 +2228,19 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + func= RNA_def_function(srna, "new", "rna_RenderLayer_add"); + RNA_def_function_ui_description(func, "Add a render layer to scene"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm= RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "render_layer", "SceneRenderLayer", "", "Newly created render layer"); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_RenderLayer_remove"); + RNA_def_function_ui_description(func, "Remove a render layer"); + RNA_def_function_flag(func, FUNC_USE_MAIN|FUNC_USE_SELF_ID); + parm= RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } static void rna_def_scene_render_data(BlenderRNA *brna) From aa19d53de131dc46ce799a4befc1c1e829193a6a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Nov 2011 08:42:44 +0000 Subject: [PATCH 152/203] edits to 41957, main changes to render layer removal. - report an error if the layer can't be removed - check the render layer is in the list before removing --- source/blender/blenkernel/intern/scene.c | 18 ++++++++++++------ source/blender/makesrna/intern/rna_scene.c | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index eefc5e09dbb..483e95f2abb 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1090,13 +1090,12 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name) { SceneRenderLayer *srl; -// int tot= 1 + BLI_countlist(&sce->r.layers); if(!name) name= "RenderLayer"; srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer"); - strcpy(srl->name, name); + BLI_strncpy(srl->name, name, sizeof(srl->name)); BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(srl->name)); BLI_addtail(&sce->r.layers, srl); @@ -1108,20 +1107,27 @@ SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name) return srl; } -int scene_remove_render_layer(Main *main, Scene *scene, SceneRenderLayer *srl) +int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl) { + const int act= BLI_findindex(&scene->r.layers, srl); Scene *sce; - int act= BLI_findindex(&scene->r.layers, srl); - if(BLI_countlist(&scene->r.layers) <= 1) + if (act == -1) { return 0; + } + else if ( (scene->r.layers.first == scene->r.layers.last) && + (scene->r.layers.first == srl)) + { + /* ensure 1 layer is kept */ + return 0; + } BLI_remlink(&scene->r.layers, srl); MEM_freeN(srl); scene->r.actlay= 0; - for(sce = main->scene.first; sce; sce = sce->id.next) { + for(sce = bmain->scene.first; sce; sce = sce->id.next) { if(sce->nodetree) { bNode *node; for(node = sce->nodetree->nodes.first; node; node = node->next) { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1bb184c9433..e1fe34d5baf 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -734,7 +734,7 @@ static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA valu if (index != -1) rd->actlay= index; } -static SceneRenderLayer *rna_RenderLayer_add(ID *id, RenderData *UNUSED(rd), const char *name) +static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name) { Scene *scene= (Scene *)id; SceneRenderLayer *srl= scene_add_render_layer(scene, name); @@ -744,13 +744,16 @@ static SceneRenderLayer *rna_RenderLayer_add(ID *id, RenderData *UNUSED(rd), con return srl; } -static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, SceneRenderLayer *srl) +static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, SceneRenderLayer *srl) { Scene *scene= (Scene *)id; - scene_remove_render_layer(bmain, scene, srl); - - WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); + if (!scene_remove_render_layer(bmain, scene, srl)) { + BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'", srl->name, scene->id.name+2); + } + else { + WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); + } } static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) @@ -2228,17 +2231,17 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - func= RNA_def_function(srna, "new", "rna_RenderLayer_add"); + func= RNA_def_function(srna, "new", "rna_RenderLayer_new"); RNA_def_function_ui_description(func, "Add a render layer to scene"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); parm= RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "render_layer", "SceneRenderLayer", "", "Newly created render layer"); + parm= RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer"); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_RenderLayer_remove"); RNA_def_function_ui_description(func, "Remove a render layer"); - RNA_def_function_flag(func, FUNC_USE_MAIN|FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_MAIN|FUNC_USE_REPORTS|FUNC_USE_SELF_ID); parm= RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } From 971065ec9a596fc9009ed542dfa1f3ab32ef96c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 08:48:33 +0000 Subject: [PATCH 153/203] Set floor fails to make camera be in positive Z half-space if it was parented to other object. --- source/blender/editors/space_clip/tracking_ops.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 7ef7e69c143..43df8b0ea47 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1919,11 +1919,10 @@ static int set_floor_exec(bContext *C, wmOperator *op) object_apply_mat4(parent, newmat, 0, 0); /* make camera have positive z-coordinate */ - mul_v3_m4v3(vec[0], mat, camera->loc); - if(camera->loc[2]<0) { + if(parent->loc[2]<0) { invert_m4(rot); mul_m4_m4m4(newmat, mat, rot); - object_apply_mat4(camera, newmat, 0, 0); + object_apply_mat4(parent, newmat, 0, 0); } where_is_object(scene, parent); From 7084ab4f43555fa6d9976895bb457e942937306e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 18 Nov 2011 09:16:29 +0000 Subject: [PATCH 154/203] Moving spanish code from es_ES to es for now (as the best spanish translation is es.po...). Else, gettext first search into es_ES (and es_MX it seems???), before using content from es, which currently is not good. --- source/blender/blenfont/intern/blf_lang.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index e8c6ff76934..2ba23e501b4 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -78,7 +78,7 @@ static const char *locales[] = { "finnish", "fi_FI", "swedish", "sv_SE", "french", "fr_FR", - "spanish", "es_ES", + "spanish", "es", "catalan", "ca_AD", "czech", "cs_CZ", "ptb", "pt_BR", diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4c53011390f..329a8b70d85 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2620,7 +2620,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"}, {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"}, {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"}, - {9, "SPANISH", 0, "Spanish (Español)", "es_ES"}, + {9, "SPANISH", 0, "Spanish (Español)", "es"}, {0, "", 0, "In progress", ""}, {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"}, From d498dd393970c4bfddaf3236433171c4274776d8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Nov 2011 09:23:55 +0000 Subject: [PATCH 155/203] make RNA_def_float_rotation usable for single value rotations (not arrays). --- source/blender/makesrna/intern/rna_define.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index d4756ecfefa..48274ffbd7a 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -2409,9 +2409,15 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *iden ContainerRNA *cont= cont_; PropertyRNA *prop; - prop= RNA_def_property(cont, identifier, PROP_FLOAT, PROP_EULER); // XXX - if(len != 0) RNA_def_property_array(prop, len); - if(default_value) RNA_def_property_float_array_default(prop, default_value); + prop= RNA_def_property(cont, identifier, PROP_FLOAT, (len != 0) ? PROP_EULER : PROP_ANGLE); + if(len != 0) { + RNA_def_property_array(prop, len); + if(default_value) RNA_def_property_float_array_default(prop, default_value); + } + else { + /* RNA_def_property_float_default must be called outside */ + BLI_assert(default_value == NULL); + } if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); From cc314e442c1dfc6646be0d04675c3dc16cfc2eaf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 14:28:45 +0000 Subject: [PATCH 156/203] Rename bgpic.add() to bgpic.new() to correspond others collections like render layers, vertices groups and so. Also added bgpig.remove() function to remove specified picture. --- release/scripts/startup/bl_operators/clip.py | 2 +- source/blender/editors/include/ED_view3d.h | 3 +- .../editors/space_view3d/view3d_edit.c | 28 +++++++++++++------ source/blender/makesrna/intern/rna_space.c | 21 ++++++++++---- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index d5d9684bcf3..dc0d35062e6 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -211,7 +211,7 @@ class CLIP_OT_set_viewport_background(Operator): break if not bgpic: - bgpic = space_v3d.background_images.add() + bgpic = space_v3d.background_images.new() bgpic.source = 'MOVIE' bgpic.clip = clip diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 82a1e6f1f00..6536741af00 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -290,6 +290,7 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the view to the camera, return TRUE if */ int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); -struct BGpic *ED_view3D_background_image_add(struct View3D *v3d); +struct BGpic *ED_view3D_background_image_new(struct View3D *v3d); +void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 7eaa5d42dd0..771accd462b 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2944,7 +2944,7 @@ static BGpic *background_image_add(bContext *C) { View3D *v3d= CTX_wm_view3d(C); - return ED_view3D_background_image_add(v3d); + return ED_view3D_background_image_new(v3d); } static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op)) @@ -3014,16 +3014,13 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot) /* ***** remove image operator ******* */ static int background_image_remove_exec(bContext *C, wmOperator *op) { - View3D *vd = CTX_wm_view3d(C); + View3D *v3d = CTX_wm_view3d(C); int index = RNA_int_get(op->ptr, "index"); - BGpic *bgpic_rem= BLI_findlink(&vd->bgpicbase, index); + BGpic *bgpic_rem= BLI_findlink(&v3d->bgpicbase, index); if(bgpic_rem) { - BLI_remlink(&vd->bgpicbase, bgpic_rem); - if(bgpic_rem->ima) id_us_min(&bgpic_rem->ima->id); - if(bgpic_rem->clip) id_us_min(&bgpic_rem->clip->id); - MEM_freeN(bgpic_rem); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, vd); + ED_view3D_background_image_remove(v3d, bgpic_rem); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d); return OPERATOR_FINISHED; } else { @@ -3529,7 +3526,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co object_apply_mat4(ob, mat, TRUE, TRUE); } -BGpic *ED_view3D_background_image_add(View3D *v3d) +BGpic *ED_view3D_background_image_new(View3D *v3d) { BGpic *bgpic= MEM_callocN(sizeof(BGpic), "Background Image"); @@ -3543,3 +3540,16 @@ BGpic *ED_view3D_background_image_add(View3D *v3d) return bgpic; } + +void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic) +{ + BLI_remlink(&v3d->bgpicbase, bgpic); + + if(bgpic->ima) + id_us_min(&bgpic->ima->id); + + if(bgpic->clip) + id_us_min(&bgpic->clip->id); + + MEM_freeN(bgpic); +} diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8fb232332d5..393ffa69cbc 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -891,15 +891,22 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value) bgpic->blend = 1.0f - value; } -static BGpic *rna_BackgroundImage_add(View3D *v3d) +static BGpic *rna_BackgroundImage_new(View3D *v3d) { - BGpic *bgpic= ED_view3D_background_image_add(v3d);; + BGpic *bgpic= ED_view3D_background_image_new(v3d); - WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); + WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d); return bgpic; } +static void rna_BackgroundImage_remove(View3D *v3d, BGpic *bgpic) +{ + ED_view3D_background_image_remove(v3d, bgpic); + + WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d); +} + /* Space Node Editor */ static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value) @@ -1307,11 +1314,15 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images"); - func= RNA_def_function(srna, "add", "rna_BackgroundImage_add"); + func= RNA_def_function(srna, "new", "rna_BackgroundImage_new"); RNA_def_function_ui_description(func, "Add new background image"); - parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background"); RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_BackgroundImage_remove"); + RNA_def_function_ui_description(func, "Remove background image"); + parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background"); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } static void rna_def_space_view3d(BlenderRNA *brna) From dae43b5487ca97e691ce3cd3d688205255cd05fb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 14:42:18 +0000 Subject: [PATCH 157/203] Camera tracking: multiply all camera matrices by inverted first reconstructed camera matrix This makes blender camera: - Be located on exactly the same position at first frame after applying Camera Solver constraint - Be looking in exactly the same direction it used to look before applying Camera Solver constraint Before this patch in most of cases camera used to change direction after applying solved data on it which can be confusing in some cases. Currently solved files wouldn't be broken, but after solve scene should be re-oriented. Not big deal because re-solving isn't so safe for scene orientation anyway. --- source/blender/blenkernel/intern/tracking.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 59fdf403f0f..49e6d598ea2 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1285,8 +1285,10 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib MovieTrackingTrack *track; MovieTrackingReconstruction *reconstruction= &tracking->reconstruction; MovieReconstructedCamera *reconstructed; - float origin[3]= {0.0f, 0.0f, 0.0f}; int ok= 1; + float imat[4][4]; + + unit_m4(imat); track= tracking->tracks.first; while(track) { @@ -1354,12 +1356,13 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib mat[i][j]= matd[i][j]; if(!origin_set) { - copy_v3_v3(origin, mat[3]); + copy_m4_m4(imat, mat); + invert_m4(imat); origin_set= 1; } if(origin_set) - sub_v3_v3(mat[3], origin); + mul_m4_m4m4(mat, mat, imat); copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat); reconstructed[reconstruction->camnr].framenr= a; @@ -1380,7 +1383,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib track= tracking->tracks.first; while(track) { if(track->flag&TRACK_HAS_BUNDLE) - sub_v3_v3(track->bundle_pos, origin); + mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos); track= track->next; } From b4097ad11d77e1ecc3ed9ed61cb6970162c547f8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 15:29:40 +0000 Subject: [PATCH 158/203] Re-commit reverted changes from rev41394. was accidentally reverted when trunk was prepared for tomato merge. --- source/blender/editors/space_view3d/view3d_edit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 771accd462b..fe3a5a3b4d5 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3535,6 +3535,7 @@ BGpic *ED_view3D_background_image_new(View3D *v3d) bgpic->iuser.fie_ima= 2; bgpic->iuser.ok= 1; bgpic->view= 0; /* 0 for all */ + bgpic->flag |= V3D_BGPIC_EXPANDED; BLI_addtail(&v3d->bgpicbase, bgpic); From 02ce6fd59ca237f0bbaebfb50be9f74039d99e93 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 15:39:40 +0000 Subject: [PATCH 159/203] Cycles: try to avoid NaN pixels with oren nayar. Also small cmake code cleanup. --- intern/cycles/CMakeLists.txt | 1 + intern/cycles/cmake/external_libs.cmake | 15 --------------- intern/cycles/kernel/svm/bsdf_oren_nayar.h | 10 ++++++---- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index cfff7485e61..2a7a6f4ca65 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -62,6 +62,7 @@ include_directories( if(WITH_CYCLES_BLENDER) add_subdirectory(blender) + add_definitions(-DBLENDER_PLUGIN) endif(WITH_CYCLES_BLENDER) add_subdirectory(app) diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 9037362f1ab..7d12e261068 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -70,21 +70,6 @@ if(WITH_CYCLES_PARTIO) endif() -########################################################################### -# Blender - -if(WITH_CYCLES_BLENDER) - - set(BLENDER_INCLUDE_DIRS - ${CMAKE_SOURCE_DIR}/intern/guardedalloc - ${CMAKE_SOURCE_DIR}/source/blender/makesdna - ${CMAKE_SOURCE_DIR}/source/blender/makesrna - ${CMAKE_SOURCE_DIR}/source/blender/blenloader - ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern) - - add_definitions(-DBLENDER_PLUGIN) -endif() - ########################################################################### # CUDA diff --git a/intern/cycles/kernel/svm/bsdf_oren_nayar.h b/intern/cycles/kernel/svm/bsdf_oren_nayar.h index 11dc07e485c..0ad7cad06bb 100644 --- a/intern/cycles/kernel/svm/bsdf_oren_nayar.h +++ b/intern/cycles/kernel/svm/bsdf_oren_nayar.h @@ -70,8 +70,8 @@ __device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n, cos_b = nl; } - float sin_a = sqrtf(1.0f - cos_a * cos_a); - float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN); + float sin_a = sqrtf(max(1.0f - cos_a * cos_a, 0.0f)); + float tan_b = sqrtf(max(1.0f - cos_b * cos_b, 0.0f)) / max(cos_b, 1e-8f); float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b); return make_float3(is, is, is); @@ -84,8 +84,10 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig sigma = clamp(sigma, 0.0f, 1.0f); - sc->data0 = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F); - sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI_F); + float div = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F); + + sc->data0 = 1.0f * div; + sc->data1 = sigma * div; } __device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness) From 539c94a0511fb98fdbae0ce78c815c45a805e36e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 15:52:00 +0000 Subject: [PATCH 160/203] Camera: some code refactoring, use an intermediate CameraParams struct instead of long list of variables everywhere. Intention is to also let 3d view use this eventually, instead of duplicating code. --- source/blender/blenkernel/BKE_camera.h | 58 +++- source/blender/blenkernel/intern/camera.c | 254 +++++++++--------- source/blender/blenkernel/intern/constraint.c | 27 +- .../editors/sculpt_paint/paint_image.c | 24 +- .../blender/editors/space_view3d/drawobject.c | 2 +- .../editors/space_view3d/view3d_draw.c | 26 +- .../composite/nodes/node_composite_defocus.c | 2 +- .../render/extern/include/RE_pipeline.h | 1 + .../render/intern/include/render_types.h | 3 - source/blender/render/intern/source/envmap.c | 12 +- .../blender/render/intern/source/initrender.c | 57 +++- 11 files changed, 272 insertions(+), 194 deletions(-) diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index fc0ef0248f3..4a0f38d926c 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -36,6 +36,8 @@ extern "C" { #endif +#include "DNA_vec_types.h" + struct Camera; struct Object; struct RenderData; @@ -48,16 +50,54 @@ struct Camera *copy_camera(struct Camera *cam); void make_local_camera(struct Camera *cam); void free_camera(struct Camera *ca); -float dof_camera(struct Object *ob); +/* Camera Object */ -void object_camera_mode(struct RenderData *rd, struct Object *camera); -void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty, - float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit); -void object_camera_matrix( - struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second, - float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, - float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor, - float *viewdx, float *viewdy); +float object_camera_dof_distance(struct Object *ob); +void object_camera_mode(struct RenderData *rd, struct Object *ob); + +/* Camera Parameters: + * + * Intermediate struct for storing camera parameters from various sources, + * to unify computation of viewplane, window matrix, ... */ + +typedef struct CameraParams { + /* lens */ + int is_ortho; + float lens; + float ortho_scale; + + float shiftx; + float shifty; + + /* sensor */ + float sensor_x; + float sensor_y; + int sensor_fit; + + /* clipping */ + float clipsta; + float clipend; + + /* fields */ + int use_fields; + int field_second; + int field_odd; + + /* compute result */ + float ycor; + + float viewdx; + float viewdy; + rctf viewplane; + + float winmat[4][4]; +} CameraParams; + +void camera_params_init(CameraParams *params); +void camera_params_from_object(CameraParams *params, struct Object *camera); +void camera_params_compute(CameraParams *params, int winx, int winy, float aspx, float aspy); + +/* Camera View Frame */ void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 6ba7a76dd5c..858351ebbf3 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -46,6 +46,8 @@ #include "BKE_library.h" #include "BKE_main.h" +/****************************** Camera Datablock *****************************/ + void *add_camera(const char *name) { Camera *cam; @@ -121,8 +123,26 @@ void make_local_camera(Camera *cam) } } +void free_camera(Camera *ca) +{ + BKE_free_animdata((ID *)ca); +} + +/******************************** Camera Usage *******************************/ + +void object_camera_mode(RenderData *rd, Object *cam_ob) +{ + rd->mode &= ~(R_ORTHO|R_PANORAMA); + + if(cam_ob && cam_ob->type==OB_CAMERA) { + Camera *cam= cam_ob->data; + if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO; + if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA; + } +} + /* get the camera's dof value, takes the dof object into account */ -float dof_camera(Object *ob) +float object_camera_dof_distance(Object *ob) { Camera *cam = (Camera *)ob->data; if (ob->type != OB_CAMERA) @@ -141,175 +161,155 @@ float dof_camera(Object *ob) return cam->YF_dofdist; } -void free_camera(Camera *ca) +/******************************** Camera Params *******************************/ + +static int camera_sensor_fit(int sensor_fit, float sizex, float sizey) { - BKE_free_animdata((ID *)ca); + if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) { + if(sizex >= sizey) + return CAMERA_SENSOR_FIT_HOR; + else + return CAMERA_SENSOR_FIT_VERT; + } + + return sensor_fit; } -void object_camera_mode(RenderData *rd, Object *camera) +void camera_params_init(CameraParams *params) { - rd->mode &= ~(R_ORTHO|R_PANORAMA); - if(camera && camera->type==OB_CAMERA) { - Camera *cam= camera->data; - if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO; - if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA; - } + memset(params, 0, sizeof(CameraParams)); + + /* defaults */ + params->sensor_x= DEFAULT_SENSOR_WIDTH; + params->sensor_y= DEFAULT_SENSOR_HEIGHT; + params->sensor_fit= CAMERA_SENSOR_FIT_AUTO; } -void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty, - float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit) +void camera_params_from_object(CameraParams *params, Object *ob) { - Camera *cam= NULL; + if(!ob) + return; - (*shiftx)= 0.0f; - (*shifty)= 0.0f; + if(ob->type==OB_CAMERA) { + /* camera object */ + Camera *cam= ob->data; - (*sensor_x)= DEFAULT_SENSOR_WIDTH; - (*sensor_y)= DEFAULT_SENSOR_HEIGHT; - (*sensor_fit)= CAMERA_SENSOR_FIT_AUTO; + if(cam->type == CAM_ORTHO) + params->is_ortho= TRUE; + params->lens= cam->lens; + params->ortho_scale= cam->ortho_scale; - if(camera->type==OB_CAMERA) { - cam= camera->data; + params->shiftx= cam->shiftx; + params->shifty= cam->shifty; - if(cam->type == CAM_ORTHO) { - *is_ortho= TRUE; - } + params->sensor_x= cam->sensor_x; + params->sensor_y= cam->sensor_y; + params->sensor_fit= cam->sensor_fit; - /* solve this too... all time depending stuff is in convertblender.c? - * Need to update the camera early because it's used for projection matrices - * and other stuff BEFORE the animation update loop is done - * */ -#if 0 // XXX old animation system - if(cam->ipo) { - calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra)); - execute_ipo(&cam->id, cam->ipo); - } -#endif // XXX old animation system - (*shiftx)=cam->shiftx; - (*shifty)=cam->shifty; - (*lens)= cam->lens; - (*sensor_x)= cam->sensor_x; - (*sensor_y)= cam->sensor_y; - (*clipsta)= cam->clipsta; - (*clipend)= cam->clipend; - (*sensor_fit)= cam->sensor_fit; + params->clipsta= cam->clipsta; + params->clipend= cam->clipend; } - else if(camera->type==OB_LAMP) { - Lamp *la= camera->data; + else if(ob->type==OB_LAMP) { + /* lamp object */ + Lamp *la= ob->data; float fac= cosf((float)M_PI*la->spotsize/360.0f); float phi= acos(fac); - (*lens)= 16.0f*fac/sinf(phi); - if((*lens)==0.0f) - (*lens)= 35.0f; - (*clipsta)= la->clipsta; - (*clipend)= la->clipend; - } - else { /* envmap exception... */; - if((*lens)==0.0f) /* is this needed anymore? */ - (*lens)= 16.0f; + params->lens= 16.0f*fac/sinf(phi); + if(params->lens==0.0f) + params->lens= 35.0f; - if((*clipsta)==0.0f || (*clipend)==0.0f) { - (*clipsta)= 0.1f; - (*clipend)= 1000.0f; - } + params->clipsta= la->clipsta; + params->clipend= la->clipend; } - - (*cam_r)= cam; } -/* 'lens' may be set for envmap only */ -void object_camera_matrix( - RenderData *rd, Object *camera, int winx, int winy, short field_second, - float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens, - float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor, - float *viewdx, float *viewdy) +void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, float yasp) { - Camera *cam=NULL; - float pixsize; - float shiftx=0.0, shifty=0.0, winside, viewfac; - short is_ortho= FALSE; + rctf viewplane; + float pixsize, winside, viewfac; + int sensor_fit; - /* question mark */ - (*ycor)= rd->yasp / rd->xasp; - if(rd->mode & R_FIELDS) - (*ycor) *= 2.0f; + /* fields rendering */ + params->ycor= yasp/xasp; + if(params->use_fields) + params->ycor *= 2.0f; - object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit); + /* determine sensor fit */ + sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy); - /* ortho only with camera available */ - if(cam && is_ortho) { - if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) { - if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx; - else viewfac= (*ycor) * winy; - } - else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) { + if(params->is_ortho) { + /* orthographic camera, scale == 1.0 means exact 1 to 1 mapping */ + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) viewfac= winx; - } - else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */ - viewfac= (*ycor) * winy; - } + else + viewfac= params->ycor * winy; - /* ortho_scale == 1.0 means exact 1 to 1 mapping */ - pixsize= cam->ortho_scale/viewfac; + pixsize= params->ortho_scale/viewfac; } else { - if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) { - if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx) / (*sensor_x); - else viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x); - } - else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) { - viewfac= ((*lens) * winx) / (*sensor_x); - } - else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */ - viewfac= ((*lens) * winy) / (*sensor_y); - } + /* perspective camera */ + float sensor_size; - pixsize= (*clipsta) / viewfac; + /* note for auto fit sensor_x is both width and height */ + if(params->sensor_fit == CAMERA_SENSOR_FIT_VERT) + sensor_size= params->sensor_y; + else + sensor_size= params->sensor_x; + + if(sensor_fit == CAMERA_SENSOR_FIT_HOR) + viewfac= (params->lens * winx) / sensor_size; + else + viewfac= params->ycor * (params->lens * winy) / sensor_size; + + pixsize= params->clipsta/viewfac; } - /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */ - winside= MAX2(winx, winy); + /* compute view plane: + * fully centered, zbuffer fills in jittered between -.5 and +.5 */ + if(sensor_fit == CAMERA_SENSOR_FIT_HOR) + winside= winx; + else + winside= winy; - if(cam) { - if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) - winside= winx; - else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) - winside= winy; - } + viewplane.xmin= -0.5f*(float)winx + params->shiftx*winside; + viewplane.ymin= -0.5f*params->ycor*(float)winy + params->shifty*winside; + viewplane.xmax= 0.5f*(float)winx + params->shiftx*winside; + viewplane.ymax= 0.5f*params->ycor*(float)winy + params->shifty*winside; - viewplane->xmin= -0.5f*(float)winx + shiftx*winside; - viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside; - viewplane->xmax= 0.5f*(float)winx + shiftx*winside; - viewplane->ymax= 0.5f*(*ycor)*(float)winy + shifty*winside; - - if(field_second) { - if(rd->mode & R_ODDFIELD) { - viewplane->ymin-= 0.5f * (*ycor); - viewplane->ymax-= 0.5f * (*ycor); + if(params->field_second) { + if(params->field_odd) { + viewplane.ymin-= 0.5f * params->ycor; + viewplane.ymax-= 0.5f * params->ycor; } else { - viewplane->ymin+= 0.5f * (*ycor); - viewplane->ymax+= 0.5f * (*ycor); + viewplane.ymin+= 0.5f * params->ycor; + viewplane.ymax+= 0.5f * params->ycor; } } + /* the window matrix is used for clipping, and not changed during OSA steps */ /* using an offset of +0.5 here would give clip errors on edges */ - viewplane->xmin *= pixsize; - viewplane->xmax *= pixsize; - viewplane->ymin *= pixsize; - viewplane->ymax *= pixsize; + viewplane.xmin *= pixsize; + viewplane.xmax *= pixsize; + viewplane.ymin *= pixsize; + viewplane.ymax *= pixsize; - (*viewdx)= pixsize; - (*viewdy)= (*ycor) * pixsize; + params->viewdx= pixsize; + params->viewdy= params->ycor * pixsize; - if(is_ortho) - orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend); + if(params->is_ortho) + orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax, + viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); else - perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend); - + perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax, + viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); + + params->viewplane= viewplane; } +/***************************** Camera View Frame *****************************/ + void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]) { @@ -331,7 +331,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh r_asp[1]= aspy / aspx; } } - else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + else if(camera->sensor_fit==CAMERA_SENSOR_FIT_HOR) { r_asp[0]= aspx / aspy; r_asp[1]= 1.0; } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index abcd6903686..6f29594f811 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3988,7 +3988,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase MovieTrackingMarker *marker; float vec[3], disp[3], axis[3], mat[4][4]; float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp); - float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f; + float len, d; where_is_object_mat(scene, camob, mat); @@ -4006,23 +4006,20 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase len= len_v3(disp); if (len > FLT_EPSILON) { - float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f; - short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO; - Camera *cam= NULL; + CameraParams params; + float pos[2], rmat[4][4]; user.framenr= scene->r.cfra; marker= BKE_tracking_get_marker(track, user.framenr); add_v2_v2v2(pos, marker->pos, track->offset); - object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit); - - if (is_ortho) { - if (cam) - ortho_scale= cam->ortho_scale; - - vec[0]= ortho_scale * (pos[0]-0.5f+shiftx); - vec[1]= ortho_scale * (pos[1]-0.5f+shifty); + camera_params_init(¶ms); + camera_params_from_object(¶ms, camob); + + if (params.is_ortho) { + vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx); + vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty); vec[2]= -len; if (aspect > 1.0f) vec[1] /= aspect; @@ -4037,10 +4034,10 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase copy_v3_v3(cob->matrix[3], disp); } else { - d= (len*sensor_x) / (2.0f*lens); + d= (len*params.sensor_x) / (2.0f*params.lens); - vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f); - vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f); + vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f); + vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f); vec[2]= -len; if (aspect > 1.0f) vec[1] /= aspect; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ff2a1adbdf5..97a0c92d197 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3057,25 +3057,23 @@ static void project_paint_begin(ProjPaintState *ps) invert_m4_m4(viewinv, viewmat); } else if (ps->source==PROJ_SRC_IMAGE_CAM) { - Object *camera= ps->scene->camera; - - /* dont actually use these */ - float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; - short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; - rctf _viewplane; + Object *cam_ob= ps->scene->camera; + CameraParams params; /* viewmat & viewinv */ - copy_m4_m4(viewinv, ps->scene->camera->obmat); + copy_m4_m4(viewinv, cam_ob->obmat); normalize_m4(viewinv); invert_m4_m4(viewmat, viewinv); - /* camera winmat */ - object_camera_mode(&ps->scene->r, camera); - object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0, - winmat, &_viewplane, &ps->clipsta, &ps->clipend, - &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy); + /* window matrix, clipping and ortho */ + camera_params_init(¶ms); + camera_params_from_object(¶ms, cam_ob); + camera_params_compute(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); /* XXX aspect? */ - ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0; + copy_m4_m4(winmat, params.winmat); + ps->clipsta= params.clipsta; + ps->clipend= params.clipend; + ps->is_ortho= params.is_ortho; } /* same as view3d_get_object_project_mat */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a9fe6e317e3..58d9c85b21c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1693,7 +1693,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base if(cam->flag & CAM_SHOWLIMITS) { draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF); /* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */ - draw_focus_cross(dof_camera(ob), cam->drawsize); + draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize); } wrld= scene->world; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7ce758d4f47..82f60ac639b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2485,15 +2485,13 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in /* render 3d view */ if(rv3d->persp==RV3D_CAMOB && v3d->camera) { - float winmat[4][4]; - float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; - short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; - rctf _viewplane; + CameraParams params; - object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, - &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); + camera_params_init(¶ms); + camera_params_from_object(¶ms, v3d->camera); + camera_params_compute(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); - ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); + ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat); } else { ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, NULL); @@ -2546,10 +2544,16 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w invert_m4_m4(rv3d.viewmat, rv3d.viewinv); { - float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; - short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; - rctf _viewplane; - object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); + CameraParams params; + + camera_params_init(¶ms); + camera_params_from_object(¶ms, v3d.camera); + camera_params_compute(¶ms, width, height, scene->r.xasp, scene->r.yasp); + + copy_m4_m4(rv3d.winmat, params.winmat); + v3d.near= params.clipsta; + v3d.far= params.clipend; + v3d.lens= params.lens; } mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 515d24dcc51..f1c2fb321d1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -261,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, if (camob && camob->type==OB_CAMERA) { Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; - cam_fdist = dof_camera(camob); + cam_fdist = object_camera_dof_distance(camob); if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ cam_invfdist = 1.f/cam_fdist; } diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index c00df7db87e..bcce7cbdfcc 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -188,6 +188,7 @@ void RE_SetDispRect (struct Render *re, rcti *disprect); /* set up the viewplane/perspective matrix, three choices */ struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */ void RE_SetCamera(struct Render *re, struct Object *camera); +void RE_SetEnvmapCamera(struct Render *re, struct Object *cam_ob, float viewscale, float clipsta, float clipend); void RE_SetWindow (struct Render *re, rctf *viewplane, float clipsta, float clipend); void RE_SetOrtho (struct Render *re, rctf *viewplane, float clipsta, float clipend); void RE_SetPixelSize(struct Render *re, float pixsize); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 7cad8c36df4..a931de04737 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -152,10 +152,7 @@ struct Render int partx, party; /* values for viewing */ - float lens; - float sensor_x, sensor_y; /* image sensor size, same variable in camera */ float ycor; /* (scene->xasp / scene->yasp), multiplied with 'winy' */ - short sensor_fit; float panophi, panosi, panoco, panodxp, panodxv; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 62cb29c3d5f..3512ffa865b 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -131,6 +131,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf) static Render *envmap_render_copy(Render *re, EnvMap *env) { Render *envre; + float viewscale; int cuberes; envre= RE_NewRender("Envmap"); @@ -156,15 +157,8 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->lay= re->lay; /* view stuff in env render */ - envre->lens= 16.0f; - envre->sensor_x= 32.0f; - if(env->type==ENV_PLANE) - envre->lens*= env->viewscale; - envre->ycor= 1.0f; - envre->clipsta= env->clipsta; /* render_scene_set_window() respects this for now */ - envre->clipend= env->clipend; - - RE_SetCamera(envre, env->object); + viewscale= (env->type == ENV_PLANE)? env->viewscale: 1.0f; + RE_SetEnvmapCamera(envre, env->object, viewscale, env->clipsta, env->clipend); /* callbacks */ envre->display_draw= re->display_draw; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 7bd8dad6502..e7572302676 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -451,15 +451,62 @@ struct Object *RE_GetCamera(Render *re) return re->camera_override ? re->camera_override : re->scene->camera; } +static void re_camera_params_get(Render *re, CameraParams *params, Object *cam_ob) +{ + copy_m4_m4(re->winmat, params->winmat); + + re->clipsta= params->clipsta; + re->clipend= params->clipend; + + re->ycor= params->ycor; + re->viewdx= params->viewdx; + re->viewdy= params->viewdy; + re->viewplane= params->viewplane; + + object_camera_mode(&re->r, cam_ob); +} + +void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clipsta, float clipend) +{ + CameraParams params; + + /* setup parameters */ + camera_params_init(¶ms); + camera_params_from_object(¶ms, cam_ob); + + params.lens= 16.0f*viewscale; + params.sensor_x= 32.0f; + params.sensor_y= 32.0f; + params.sensor_fit = CAMERA_SENSOR_FIT_AUTO; + params.clipsta= clipsta; + params.clipend= clipend; + + /* compute matrix, viewplane, .. */ + camera_params_compute(¶ms, re->winx, re->winy, 1.0f, 1.0f); + + /* extract results */ + re_camera_params_get(re, ¶ms, cam_ob); +} + /* call this after InitState() */ /* per render, there's one persistent viewplane. Parts will set their own viewplanes */ -void RE_SetCamera(Render *re, Object *camera) +void RE_SetCamera(Render *re, Object *cam_ob) { - object_camera_mode(&re->r, camera); + CameraParams params; - object_camera_matrix(&re->r, camera, re->winx, re->winy, re->flag & R_SEC_FIELD, - re->winmat, &re->viewplane, &re->clipsta, &re->clipend, - &re->lens, &re->sensor_x, &re->sensor_y, &re->sensor_fit, &re->ycor, &re->viewdx, &re->viewdy); + /* setup parameters */ + camera_params_init(¶ms); + camera_params_from_object(¶ms, cam_ob); + + params.use_fields= (re->r.mode & R_FIELDS); + params.field_second= (re->flag & R_SEC_FIELD); + params.field_odd= (re->r.mode & R_ODDFIELD); + + /* compute matrix, viewplane, .. */ + camera_params_compute(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); + + /* extract results */ + re_camera_params_get(re, ¶ms, cam_ob); } void RE_SetPixelSize(Render *re, float pixsize) From 6fa4beb92f69453474862ba6c06180e6ef546cd2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 16:49:03 +0000 Subject: [PATCH 161/203] Updated stubs so blenderplayer is compiling again. --- source/blenderplayer/bad_level_call_stubs/stubs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index b299de0d897..73a06a676df 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -261,7 +261,8 @@ void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist){} -struct BGpic *ED_view3D_background_image_add(struct View3D *v3d){return (struct BGpic *) NULL;} +struct BGpic *ED_view3D_background_image_new(struct View3D *v3d){return (struct BGpic *) NULL;} +void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic){} void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist){} int text_file_modified(struct Text *text){return 0;} void ED_node_shader_default(struct Material *ma){} From 97808449e617661f0a08677083ef4d6bc692e6d3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Nov 2011 20:55:06 +0000 Subject: [PATCH 162/203] Fix #29321: Video does not display, gets frozen or flickers Unfortunately, error was caused by own attempt to deal with some kind of broken videos when was investigating crashes in sequencer. Issue discovered that time was related on values stored in timecode index and using them as signed data type later. Trying to use unsigned value here leads to signed/unsigned check failures. Prefer just to pre-process that kind of videos i've been trying to deal with rather than making more global changes during BCON3. --- source/blender/imbuf/intern/anim_movie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 3c32332cd8d..db27c1cee63 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -895,7 +895,7 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx) static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, IMB_Timecode_Type tc) { - unsigned long long pts_to_search = 0; + int64_t pts_to_search = 0; double frame_rate; double pts_time_base; long long st_time; From c26c5f38529fd490638aa4b8a8070715ecf4a3fc Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 21:06:36 +0000 Subject: [PATCH 163/203] UI: small tweak to tooltips for enum menus, it wasn't very clear which description was for the property and which for the item. --- intern/cycles/CMakeLists.txt | 2 +- source/blender/editors/interface/interface.c | 5 +---- source/blender/editors/interface/interface_regions.c | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 2a7a6f4ca65..a85b2ba8c2a 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -61,8 +61,8 @@ include_directories( # Subdirectories if(WITH_CYCLES_BLENDER) - add_subdirectory(blender) add_definitions(-DBLENDER_PLUGIN) + add_subdirectory(blender) endif(WITH_CYCLES_BLENDER) add_subdirectory(app) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b34b56f31ed..4b7adbc1064 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2618,11 +2618,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s else BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value); - if(value == item[i].value) { + if(value == item[i].value) icon= item[i].icon; - if(!tip) - tip= item[i].description; - } } str= BLI_dynstr_get_cstring(dynstr); BLI_dynstr_free(dynstr); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 513f084b6e8..93e974ddb20 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -376,7 +376,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->totline++; } - if(but->type == ROW) { + if(ELEM(but->type, ROW, MENU)) { EnumPropertyItem *item; int i, totitem, free; @@ -386,7 +386,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(item[i].identifier[0] && item[i].value == (int)but->hardmax) { if(item[i].description[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); - data->color[data->totline]= 0xFFFFFF; + data->color[data->totline]= 0xDDDDDD; data->totline++; } break; From 5429a701c4f2674e6fa4c0eef8c285c13e16af0c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 21:19:03 +0000 Subject: [PATCH 164/203] Camera: more code refactoring, adding a function to create CameraParams from 3d view, deduplicating the complex code for setting up the viewplane. --- source/blender/blenkernel/BKE_camera.h | 12 +- source/blender/blenkernel/intern/camera.c | 118 ++++++++---- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/render/render_opengl.c | 2 +- .../editors/sculpt_paint/paint_image.c | 2 +- .../editors/space_view3d/view3d_view.c | 170 ++---------------- source/blender/makesrna/intern/rna_camera.c | 19 +- 7 files changed, 108 insertions(+), 217 deletions(-) diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 4a0f38d926c..8aec576b963 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -40,21 +40,27 @@ extern "C" { struct Camera; struct Object; +struct RegionView3D; struct RenderData; struct Scene; struct rctf; struct View3D; +/* Camera Datablock */ + void *add_camera(const char *name); struct Camera *copy_camera(struct Camera *cam); void make_local_camera(struct Camera *cam); void free_camera(struct Camera *ca); -/* Camera Object */ +/* Camera Usage */ float object_camera_dof_distance(struct Object *ob); void object_camera_mode(struct RenderData *rd, struct Object *ob); +int camera_sensor_fit(int sensor_fit, float sizex, float sizey); +float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y); + /* Camera Parameters: * * Intermediate struct for storing camera parameters from various sources, @@ -65,9 +71,12 @@ typedef struct CameraParams { int is_ortho; float lens; float ortho_scale; + float zoom; float shiftx; float shifty; + float offsetx; + float offsety; /* sensor */ float sensor_x; @@ -95,6 +104,7 @@ typedef struct CameraParams { void camera_params_init(CameraParams *params); void camera_params_from_object(CameraParams *params, struct Object *camera); +void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d); void camera_params_compute(CameraParams *params, int winx, int winy, float aspx, float aspy); /* Camera View Frame */ diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 858351ebbf3..29770e37ea1 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -35,6 +35,7 @@ #include "DNA_lamp_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_view3d_types.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -45,6 +46,7 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_screen.h" /****************************** Camera Datablock *****************************/ @@ -161,9 +163,16 @@ float object_camera_dof_distance(Object *ob) return cam->YF_dofdist; } -/******************************** Camera Params *******************************/ +float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) +{ + /* sensor size used to fit to. for auto, sensor_x is both x and y. */ + if(sensor_fit == CAMERA_SENSOR_FIT_VERT) + return sensor_y; -static int camera_sensor_fit(int sensor_fit, float sizex, float sizey) + return sensor_x; +} + +int camera_sensor_fit(int sensor_fit, float sizex, float sizey) { if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) { if(sizex >= sizey) @@ -175,6 +184,8 @@ static int camera_sensor_fit(int sensor_fit, float sizex, float sizey) return sensor_fit; } +/******************************** Camera Params *******************************/ + void camera_params_init(CameraParams *params) { memset(params, 0, sizeof(CameraParams)); @@ -183,6 +194,8 @@ void camera_params_init(CameraParams *params) params->sensor_x= DEFAULT_SENSOR_WIDTH; params->sensor_y= DEFAULT_SENSOR_HEIGHT; params->sensor_fit= CAMERA_SENSOR_FIT_AUTO; + + params->zoom= 1.0f; } void camera_params_from_object(CameraParams *params, Object *ob) @@ -224,10 +237,42 @@ void camera_params_from_object(CameraParams *params, Object *ob) } } +void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d) +{ + /* perspective view */ + params->lens= v3d->lens; + params->clipsta= v3d->near; + params->clipend= v3d->far; + + if(rv3d->persp==RV3D_CAMOB) { + /* camera view */ + camera_params_from_object(params, v3d->camera); + + params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 2.0f; + params->zoom= 1.0f/params->zoom; + + params->offsetx= rv3d->camdx; + params->offsety= rv3d->camdy; + + params->shiftx *= 0.5f; + params->shifty *= 0.5f; + } + else if(rv3d->persp==RV3D_ORTHO) { + /* orthographic view */ + params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality + params->clipsta= - params->clipend; + + params->is_ortho= 1; + params->ortho_scale = rv3d->dist; + } + + params->zoom *= 2.0f; +} + void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, float yasp) { rctf viewplane; - float pixsize, winside, viewfac; + float pixsize, viewfac, sensor_size, dx, dy; int sensor_fit; /* fields rendering */ @@ -235,48 +280,47 @@ void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, if(params->use_fields) params->ycor *= 2.0f; - /* determine sensor fit */ - sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy); - if(params->is_ortho) { - /* orthographic camera, scale == 1.0 means exact 1 to 1 mapping */ - if(sensor_fit==CAMERA_SENSOR_FIT_HOR) - viewfac= winx; - else - viewfac= params->ycor * winy; - - pixsize= params->ortho_scale/viewfac; + /* orthographic camera */ + /* scale == 1.0 means exact 1 to 1 mapping */ + pixsize= params->ortho_scale; } else { /* perspective camera */ - float sensor_size; - - /* note for auto fit sensor_x is both width and height */ - if(params->sensor_fit == CAMERA_SENSOR_FIT_VERT) - sensor_size= params->sensor_y; - else - sensor_size= params->sensor_x; - - if(sensor_fit == CAMERA_SENSOR_FIT_HOR) - viewfac= (params->lens * winx) / sensor_size; - else - viewfac= params->ycor * (params->lens * winy) / sensor_size; - - pixsize= params->clipsta/viewfac; + sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); + pixsize= (sensor_size * params->clipsta)/params->lens; } + /* determine sensor fit */ + sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy); + + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) + viewfac= winx; + else + viewfac= params->ycor * winy; + + pixsize /= viewfac; + + /* extra zoom factor */ + pixsize *= params->zoom; + /* compute view plane: * fully centered, zbuffer fills in jittered between -.5 and +.5 */ - if(sensor_fit == CAMERA_SENSOR_FIT_HOR) - winside= winx; - else - winside= winy; + viewplane.xmin= -0.5f*(float)winx; + viewplane.ymin= -0.5f*params->ycor*(float)winy; + viewplane.xmax= 0.5f*(float)winx; + viewplane.ymax= 0.5f*params->ycor*(float)winy; - viewplane.xmin= -0.5f*(float)winx + params->shiftx*winside; - viewplane.ymin= -0.5f*params->ycor*(float)winy + params->shifty*winside; - viewplane.xmax= 0.5f*(float)winx + params->shiftx*winside; - viewplane.ymax= 0.5f*params->ycor*(float)winy + params->shifty*winside; + /* lens shift and offset */ + dx= params->shiftx*viewfac + winx*params->offsetx; + dy= params->shifty*viewfac + winy*params->offsety; + viewplane.xmin += dx; + viewplane.ymin += dy; + viewplane.xmax += dx; + viewplane.ymax += dy; + + /* fields offset */ if(params->field_second) { if(params->field_odd) { viewplane.ymin-= 0.5f * params->ycor; @@ -297,15 +341,15 @@ void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, params->viewdx= pixsize; params->viewdy= params->ycor * pixsize; + params->viewplane= viewplane; + /* compute projection matrix */ if(params->is_ortho) orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); else perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); - - params->viewplane= viewplane; } /***************************** Camera View Frame *****************************/ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 6536741af00..e2405425891 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -208,7 +208,7 @@ void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]); void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend); int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); -int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); +int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend); void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index fa764e6eefc..843918e9173 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -147,7 +147,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rctf viewplane; float clipsta, clipend; - int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); + int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend); if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 97a0c92d197..a856f959b49 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3068,7 +3068,7 @@ static void project_paint_begin(ProjPaintState *ps) /* window matrix, clipping and ortho */ camera_params_init(¶ms); camera_params_from_object(¶ms, cam_ob); - camera_params_compute(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); /* XXX aspect? */ + camera_params_compute(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); copy_m4_m4(winmat, params.winmat); ps->clipsta= params.clipsta; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index d2d6d6b0959..cf838cb94ce 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1018,169 +1018,19 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl } /* also exposed in previewrender.c */ -int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) +int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, rctf *viewplane, float *clipsta, float *clipend) { - Camera *cam=NULL; - float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2; - float winx= (float)winxi, winy= (float)winyi; - int orth= 0; - short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + CameraParams params; - /* currnetly using sensor size (depends on fov calculating method) */ - float sensor= DEFAULT_SENSOR_WIDTH; + camera_params_init(¶ms); + camera_params_from_view3d(¶ms, v3d, rv3d); + camera_params_compute(¶ms, winx, winy, 1.0f, 1.0f); - lens= v3d->lens; + *viewplane= params.viewplane; + *clipsta= params.clipsta; + *clipend= params.clipend; - *clipsta= v3d->near; - *clipend= v3d->far; - - if(rv3d->persp==RV3D_CAMOB) { - if(v3d->camera) { - if(v3d->camera->type==OB_LAMP ) { - Lamp *la; - - la= v3d->camera->data; - fac= cosf(((float)M_PI)*la->spotsize/360.0f); - - x1= saacos(fac); - lens= 16.0f*fac/sinf(x1); - - *clipsta= la->clipsta; - *clipend= la->clipend; - } - else if(v3d->camera->type==OB_CAMERA) { - cam= v3d->camera->data; - lens= cam->lens; - sensor_x= cam->sensor_x; - sensor_y= cam->sensor_y; - *clipsta= cam->clipsta; - *clipend= cam->clipend; - sensor_fit= cam->sensor_fit; - - sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x); - } - } - } - - if(rv3d->persp==RV3D_ORTHO) { - if(winx>winy) x1= -rv3d->dist; - else x1= -winx*rv3d->dist/winy; - x2= -x1; - - if(winx>winy) y1= -winy*rv3d->dist/winx; - else y1= -rv3d->dist; - y2= -y1; - - *clipend *= 0.5f; // otherwise too extreme low zbuffer quality - *clipsta= - *clipend; - orth= 1; - } - else { - /* fac for zoom, also used for camdx */ - if(rv3d->persp==RV3D_CAMOB) { - fac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 4.0f; - } - else { - fac= 2.0; - } - - /* viewplane size depends... */ - if(cam && cam->type==CAM_ORTHO) { - /* ortho_scale == 1 means exact 1 to 1 mapping */ - float dfac= 2.0f*cam->ortho_scale/fac; - - if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(winx>winy) { - x1= -dfac; - y1= -winy*dfac/winx; - } - else { - x1= -winx*dfac/winy; - y1= -dfac; - } - } - else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { - x1= -dfac; - y1= -winy*dfac/winx; - } - else { - x1= -winx*dfac/winy; - y1= -dfac; - } - - x2= -x1; - y2= -y1; - - orth= 1; - } - else { - float dfac; - - if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(winx>winy) dfac= (sensor_x * 2.0f) / (fac*winx*lens); - else dfac= (sensor_x * 2.0f) / (fac*winy*lens); - } - else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { - dfac= (sensor_x * 2.0f) / (fac*winx*lens); - } - else { - dfac= (sensor_y * 2.0f) / (fac*winy*lens); - } - - x1= - *clipsta * winx*dfac; - x2= -x1; - y1= - *clipsta * winy*dfac; - y2= -y1; - orth= 0; - } - /* cam view offset */ - if(cam) { - float dx= 0.5f*fac*rv3d->camdx*(x2-x1); - float dy= 0.5f*fac*rv3d->camdy*(y2-y1); - - /* shift offset */ - if(cam->type==CAM_ORTHO) { - dx += cam->shiftx * cam->ortho_scale; - dy += cam->shifty * cam->ortho_scale; - } - else { - dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor; - dy += cam->shifty * (cam->clipsta / cam->lens) * sensor; - } - - x1+= dx; - x2+= dx; - y1+= dy; - y2+= dy; - } - } - - if(pixsize) { - float viewfac; - - if(orth) { - viewfac= (winx >= winy)? winx: winy; - *pixsize= 1.0f/viewfac; - } - else { - float size= ((winx >= winy)? winx: winy); - - if(sensor_fit==CAMERA_SENSOR_FIT_HOR) - size= winx; - else if(sensor_fit==CAMERA_SENSOR_FIT_VERT) - size= winy; - - viewfac= (size*lens)/sensor; - *pixsize= *clipsta/viewfac; - } - } - - viewplane->xmin= x1; - viewplane->ymin= y1; - viewplane->xmax= x2; - viewplane->ymax= y2; - - return orth; + return params.is_ortho; } void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for picking */ @@ -1190,7 +1040,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick float clipsta, clipend, x1, y1, x2, y2; int orth; - orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); + orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend); rv3d->is_persp= !orth; // printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 1e7a969caaa..77b41b507c6 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -39,34 +39,21 @@ #ifdef RNA_RUNTIME +#include "BKE_camera.h" #include "BKE_object.h" #include "BKE_depsgraph.h" -/* only for rad/deg conversion! can remove later */ -static float get_camera_sensor(Camera *cam) -{ - if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - return cam->sensor_x; - } - else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { - return cam->sensor_x; - } - else { - return cam->sensor_y; - } -} - static float rna_Camera_angle_get(PointerRNA *ptr) { Camera *cam= ptr->id.data; - float sensor= get_camera_sensor(cam); + float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); return focallength_to_fov(cam->lens, sensor); } static void rna_Camera_angle_set(PointerRNA *ptr, float value) { Camera *cam= ptr->id.data; - float sensor= get_camera_sensor(cam); + float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); cam->lens= fov_to_focallength(value, sensor); } From 4d31654a617ed5dd49792361e8c1102df25ab563 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 18 Nov 2011 23:10:56 +0000 Subject: [PATCH 165/203] Fix [#29018] Problem with multi-column dorpdown lists, when scrolling is enabled: the bottom-most elements are not shown. ui_popup_block_scrolltest needs to be aware whether uiblock is flip or not, to avoid hiding irrelevant items in multi-column scrolled menus... --- source/blender/editors/interface/interface_regions.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 93e974ddb20..3d94fd4dc56 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1446,6 +1446,8 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block) void ui_popup_block_scrolltest(uiBlock *block) { uiBut *bt; + /* Knowing direction is necessary for multi-column menus... */ + int is_flip = (block->direction & UI_TOP) && !(block->flag & UI_BLOCK_NO_FLIP); block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP); @@ -1462,9 +1464,9 @@ void ui_popup_block_scrolltest(uiBlock *block) block->flag |= UI_BLOCK_CLIPBOTTOM; /* make space for arrow */ if(bt->y2 < block->miny +10) { - if(bt->next && bt->next->y1 > bt->y1) + if(is_flip && bt->next && bt->next->y1 > bt->y1) bt->next->flag |= UI_SCROLLED; - if(bt->prev && bt->prev->y1 > bt->y1) + else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1) bt->prev->flag |= UI_SCROLLED; } } @@ -1473,9 +1475,9 @@ void ui_popup_block_scrolltest(uiBlock *block) block->flag |= UI_BLOCK_CLIPTOP; /* make space for arrow */ if(bt->y1 > block->maxy -10) { - if(bt->next && bt->next->y2 < bt->y2) + if(!is_flip && bt->next && bt->next->y2 < bt->y2) bt->next->flag |= UI_SCROLLED; - if(bt->prev && bt->prev->y2 < bt->y2) + else if(is_flip && bt->prev && bt->prev->y2 < bt->y2) bt->prev->flag |= UI_SCROLLED; } } From 26e08e1b9d53bc9ea5e3845336eb07e38d6bdc99 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 23:15:11 +0000 Subject: [PATCH 166/203] Camera Sensor: * Tweak description of sensor fit property. * Fix sensor display for auto and vertical fit. * Fix incorrect aspect ratio for camera frame drawing. --- source/blender/blenkernel/intern/camera.c | 21 +++------- .../editors/space_view3d/view3d_draw.c | 38 ++++++++++++++----- source/blender/makesrna/intern/rna_camera.c | 8 ++-- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 29770e37ea1..a8b1c2aa04f 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -364,25 +364,16 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh if (scene) { float aspx= (float) scene->r.xsch*scene->r.xasp; float aspy= (float) scene->r.ysch*scene->r.yasp; + int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy); - if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(aspx < aspy) { - r_asp[0]= aspx / aspy; - r_asp[1]= 1.0; - } - else { - r_asp[0]= 1.0; - r_asp[1]= aspy / aspx; - } - } - else if(camera->sensor_fit==CAMERA_SENSOR_FIT_HOR) { - r_asp[0]= aspx / aspy; - r_asp[1]= 1.0; - } - else { + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { r_asp[0]= 1.0; r_asp[1]= aspy / aspx; } + else { + r_asp[0]= aspx / aspy; + r_asp[1]= 1.0; + } } else { r_asp[0]= 1.0f; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 82f60ac639b..cdd90b38d0a 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1228,19 +1228,39 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); } if (ca && (ca->flag & CAM_SHOWSENSOR)) { - /* assume fixed sensor width for now */ + /* determine sensor fit, and get sensor x/y, for auto fit we + assume and square sensor and only use sensor_x */ + float sizex= scene->r.xsch*scene->r.xasp; + float sizey= scene->r.ysch*scene->r.yasp; + int sensor_fit = camera_sensor_fit(ca->sensor_fit, sizex, sizey); + float sensor_x= ca->sensor_x; + float sensor_y= (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO)? ca->sensor_x: ca->sensor_y; - /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */ - float sensor_scale = (x2i-x1i) / ca->sensor_x; - float sensor_height = sensor_scale * ca->sensor_y; + /* determine sensor plane */ + rctf rect; - float ymid = y1i + (y2i-y1i)/2.f; - float sy1= ymid - sensor_height/2.f; - float sy2= ymid + sensor_height/2.f; + if(sensor_fit == CAMERA_SENSOR_FIT_HOR) { + float sensor_scale = (x2i-x1i) / sensor_x; + float sensor_height = sensor_scale * sensor_y; + rect.xmin= x1i; + rect.xmax= x2i; + rect.ymin= (y1i + y2i)*0.5f - sensor_height*0.5f; + rect.ymax= rect.ymin + sensor_height; + } + else { + float sensor_scale = (y2i-y1i) / sensor_y; + float sensor_width = sensor_scale * sensor_x; + + rect.xmin= (x1i + x2i)*0.5f - sensor_width*0.5f; + rect.xmax= rect.xmin + sensor_width; + rect.ymin= y1i; + rect.ymax= y2i; + } + + /* draw */ UI_ThemeColorShade(TH_WIRE, 100); - - uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f); + uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f); } } diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 77b41b507c6..6f6a4baec92 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -113,9 +113,9 @@ void RNA_def_camera(BlenderRNA *brna) {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem sensor_fit_items[] = { - {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Calculate field of view using sensor size, with direction depending on image resolution"}, - {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Calculate field of view using sensor width"}, - {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Calculate field of view using sensor height"}, + {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"}, + {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"}, + {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Camera", "ID"); @@ -138,7 +138,7 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sensor_fit"); RNA_def_property_enum_items(prop, sensor_fit_items); - RNA_def_property_ui_text(prop, "Sensor Fit", "Mode of calculating field of view from sensor dimensions and focal length"); + RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); /* Number values */ From 32b3fd32452b570d8515aeec41c30c9587a5f787 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 23:32:00 +0000 Subject: [PATCH 167/203] UI: fix issue with previous commit, could show wrong tooltip. --- source/blender/editors/interface/interface_regions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 3d94fd4dc56..47dde3f03f0 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -379,11 +379,12 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(ELEM(but->type, ROW, MENU)) { EnumPropertyItem *item; int i, totitem, free; + int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but); RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free); for(i=0; ihardmax) { + if(item[i].identifier[0] && item[i].value == value) { if(item[i].description[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); data->color[data->totline]= 0xDDDDDD; From d88262a1bfe0ccd960852ba058c3db98b9be2719 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 18 Nov 2011 23:32:17 +0000 Subject: [PATCH 168/203] Camera: some more code deduplication. --- source/blender/editors/include/ED_view3d.h | 1 - .../editors/space_view3d/view3d_edit.c | 9 ++- .../editors/space_view3d/view3d_view.c | 58 ++----------------- 3 files changed, 13 insertions(+), 55 deletions(-) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index e2405425891..a90e91a7242 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -206,7 +206,6 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]); void project_float(struct ARegion *ar, const float vec[3], float adr[2]); void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]); -void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend); int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend); void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index fe3a5a3b4d5..39ef6b3c84a 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -47,6 +47,7 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BKE_camera.h" #include "BKE_context.h" #include "BKE_image.h" #include "BKE_library.h" @@ -3513,8 +3514,12 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, { ED_view3d_from_m4(ob->obmat, ofs, quat, dist); - if (lens) { - ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL); + if(lens) { + CameraParams params; + + camera_params_init(¶ms); + camera_params_from_object(¶ms, ob); + *lens= params.lens; } } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index cf838cb94ce..c416a60e410 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -104,31 +104,6 @@ float *give_cursor(Scene *scene, View3D *v3d) } -/* Gets the lens and clipping values from a camera of lamp type object */ -void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend) -{ - if(ob->type==OB_LAMP ) { - Lamp *la = ob->data; - if (lens) { - float x1, fac; - fac= cosf((float)M_PI*la->spotsize/360.0f); - x1= saacos(fac); - *lens= 16.0f*fac/sinf(x1); - } - if (clipsta) *clipsta= la->clipsta; - if (clipend) *clipend= la->clipend; - } - else if(ob->type==OB_CAMERA) { - Camera *cam= ob->data; - if (lens) *lens= cam->lens; - if (clipsta) *clipsta= cam->clipsta; - if (clipend) *clipend= cam->clipend; - } - else { - if (lens) *lens= 35.0f; - } -} - /* ****************** smooth view operator ****************** */ /* This operator is one of the 'timer refresh' ones like animation playback */ @@ -985,36 +960,15 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) /* copies logic of get_view3d_viewplane(), keep in sync */ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { - int orth= 0; + CameraParams params; - *clipsta= v3d->near; - *clipend= v3d->far; + camera_params_init(¶ms); + camera_params_from_view3d(¶ms, v3d, rv3d); - if(rv3d->persp==RV3D_CAMOB) { - if(v3d->camera) { - if(v3d->camera->type==OB_LAMP ) { - Lamp *la= v3d->camera->data; - *clipsta= la->clipsta; - *clipend= la->clipend; - } - else if(v3d->camera->type==OB_CAMERA) { - Camera *cam= v3d->camera->data; - *clipsta= cam->clipsta; - *clipend= cam->clipend; + *clipsta= params.clipsta; + *clipend= params.clipend; - if(cam->type==CAM_ORTHO) - orth= 1; - } - } - } - - if(rv3d->persp==RV3D_ORTHO) { - *clipend *= 0.5f; // otherwise too extreme low zbuffer quality - *clipsta= - *clipend; - orth= 1; - } - - return orth; + return params.is_ortho; } /* also exposed in previewrender.c */ From 658552715140ef0e6f3be02c900260f99615344e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 00:01:10 +0000 Subject: [PATCH 169/203] add python3 checks to avoid confusion from errors with python2. --- build_files/cmake/cmake_consistency_check.py | 6 ++++++ build_files/cmake/project_info.py | 7 +++++++ build_files/cmake/project_source_info.py | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index be68455a113..65a9442a90d 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -22,6 +22,12 @@ # +import sys +if not sys.version.startswith("3"): + print("\nPython3.x needed, found %s.\nAborting!\n" % + sys.version.partition(" ")[0]) + sys.exit(1) + from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR import os diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 7162b324f94..dca41849a49 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -44,7 +44,14 @@ __all__ = ( "project_name_get" ) + import sys +if not sys.version.startswith("3"): + print("\nPython3.x needed, found %s.\nAborting!\n" % + sys.version.partition(" ")[0]) + sys.exit(1) + + import os from os.path import join, dirname, normpath, abspath, splitext, exists diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index d4b48ccd859..a39ed94bd69 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -25,6 +25,14 @@ __all__ = ( "SOURCE_DIR", ) + +import sys +if not sys.version.startswith("3"): + print("\nPython3.x needed, found %s.\nAborting!\n" % + sys.version.partition(" ")[0]) + sys.exit(1) + + import os from os.path import join, dirname, normpath, abspath From 14ddf19ad20553f81e014e45846b370237df28c3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 00:52:54 +0000 Subject: [PATCH 170/203] make it clearer which arguments in transform snap are return values (no functional change) --- source/blender/editors/include/ED_transform.h | 8 +- .../editors/transform/transform_snap.c | 129 ++++++++++-------- 2 files changed, 75 insertions(+), 62 deletions(-) diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 37f647abfd9..2ca3e2bfe7f 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -183,10 +183,10 @@ typedef enum SnapMode #define SNAP_MIN_DISTANCE 30 -int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]); -int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]); -int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode); -int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode); +int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]); +int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]); +int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode); +int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode); #endif diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 6e81200016d..4635411dcdf 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -94,9 +94,9 @@ static void setSnappingCallback(TransInfo *t); static void ApplySnapTranslation(TransInfo *t, float vec[3]); static void ApplySnapRotation(TransInfo *t, float *vec); -static void ApplySnapResize(TransInfo *t, float *vec); +static void ApplySnapResize(TransInfo *t, float vec[2]); -static void CalcSnapGrid(TransInfo *t, float *vec); +/* static void CalcSnapGrid(TransInfo *t, float *vec); */ static void CalcSnapGeometry(TransInfo *t, float *vec); static void TargetSnapMedian(TransInfo *t); @@ -701,7 +701,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) +static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } @@ -1035,7 +1035,7 @@ static void TargetSnapClosest(TransInfo *t) } /*================================================================*/ #ifndef USE_BVH_FACE_SNAP -static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth) +static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth) { float lambda; int result; @@ -1087,7 +1087,9 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl } #endif -static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth) +static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3], + const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2], + float r_loc[3], float r_no[3], int *r_dist, float *r_depth) { float intersect[3] = {0, 0, 0}, ray_end[3], dvec[3]; int result; @@ -1141,11 +1143,11 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh * this takes care of series of connected edges a bit slanted w.r.t the viewport * otherwise, it would stick to the verts of the closest edge and not slide along merrily * */ - if (new_dist <= *dist && new_depth < *depth * 1.001f) + if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f) { float n1[3], n2[3]; - *depth = new_depth; + *r_depth = new_depth; retval = 1; sub_v3_v3v3(edge_loc, v1co, v2co); @@ -1153,18 +1155,18 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc); - if (no) + if (r_no) { normal_short_to_float_v3(n1, v1no); normal_short_to_float_v3(n2, v2no); - interp_v3_v3v3(no, n2, n1, mul); - mul_m3_v3(timat, no); - normalize_v3(no); + interp_v3_v3v3(r_no, n2, n1, mul); + mul_m3_v3(timat, r_no); + normalize_v3(r_no); } - copy_v3_v3(loc, location); + copy_v3_v3(r_loc, location); - *dist = new_dist; + *r_dist = new_dist; } } } @@ -1172,7 +1174,9 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh return retval; } -static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth) +static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], float timat[][3], + const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2], + float r_loc[3], float r_no[3], int *r_dist, float *r_depth) { int retval = 0; float dvec[3]; @@ -1190,33 +1194,35 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], fl mul_m4_v3(obmat, location); - new_depth = len_v3v3(location, ray_start); + new_depth = len_v3v3(location, ray_start); project_int(ar, location, screen_loc); new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); - if (new_dist <= *dist && new_depth < *depth) + if (new_dist <= *r_dist && new_depth < *r_depth) { - *depth = new_depth; + *r_depth = new_depth; retval = 1; - copy_v3_v3(loc, location); + copy_v3_v3(r_loc, location); - if (no) + if (r_no) { - normal_short_to_float_v3(no, vno); - mul_m3_v3(timat, no); - normalize_v3(no); + normal_short_to_float_v3(r_no, vno); + mul_m3_v3(timat, r_no); + normalize_v3(r_no); } - *dist = new_dist; + *r_dist = new_dist; } } return retval; } -static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth) +static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], + const float ray_start[3], const float ray_normal[3], const float mval[2], + float r_loc[3], float *UNUSED(r_no), int *r_dist, float *r_depth) { float imat[4][4]; float ray_start_local[3], ray_normal_local[3]; @@ -1241,11 +1247,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm switch (snap_mode) { case SCE_SNAP_MODE_VERTEX: - retval |= snapVertex(ar, eBone->head, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); - retval |= snapVertex(ar, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); + retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); + retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); break; case SCE_SNAP_MODE_EDGE: - retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); + retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); break; } } @@ -1267,11 +1273,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm switch (snap_mode) { case SCE_SNAP_MODE_VERTEX: - retval |= snapVertex(ar, head_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); - retval |= snapVertex(ar, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); + retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); + retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); break; case SCE_SNAP_MODE_EDGE: - retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth); + retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); break; } } @@ -1281,7 +1287,9 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm return retval; } -static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth) +static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4], + const float ray_start[3], const float ray_normal[3], const float mval[2], + float r_loc[3], float r_no[3], int *r_dist, float *r_depth) { int retval = 0; int totvert = dm->getNumVerts(dm); @@ -1330,21 +1338,21 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6); hit.index = -1; - hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale); + hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale); if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) { - if(hit.dist/local_scale <= *depth) { - *depth= hit.dist/local_scale; - copy_v3_v3(loc, hit.co); - copy_v3_v3(no, hit.no); + if(hit.dist/local_scale <= *r_depth) { + *r_depth= hit.dist/local_scale; + copy_v3_v3(r_loc, hit.co); + copy_v3_v3(r_no, hit.no); /* back to worldspace */ - mul_m4_v3(obmat, loc); - copy_v3_v3(no, hit.no); + mul_m4_v3(obmat, r_loc); + copy_v3_v3(r_no, hit.no); - mul_m3_v3(timat, no); - normalize_v3(no); + mul_m3_v3(timat, r_no); + normalize_v3(r_no); retval |= 1; } @@ -1472,7 +1480,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh if (test) { - retval |= snapVertex(ar, v->co, v->no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); + retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth); } } @@ -1532,7 +1540,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh if (test) { - retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); + retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth); } } @@ -1549,7 +1557,9 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh return retval; } -static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth) +static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], + const float ray_start[3], const float ray_normal[3], const float mval[2], + float r_loc[3], float r_no[3], int *r_dist, float *r_depth) { ToolSettings *ts= scene->toolsettings; int retval = 0; @@ -1570,19 +1580,20 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); } - retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); + retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth); dm->release(dm); } else if (ob->type == OB_ARMATURE) { - retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); + retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth); } return retval; } -static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode) +static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, const float mval[2], + int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) { Base *base; float depth = FLT_MAX; @@ -1595,7 +1606,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f { Object *ob = obedit; - retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth); + retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); } /* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA @@ -1607,7 +1618,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f if(base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT) { Object *ob = base->object; - retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth); + retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); } for ( base = FIRSTBASE; base != NULL; base = base->next ) { @@ -1623,30 +1634,30 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f { Object *dob = dupli_ob->ob; - retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth); + retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); } free_object_duplilist(lb); } - retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth); + retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); } } return retval; } -int snapObjectsTransform(TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode) +int snapObjectsTransform(TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) { - return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, dist, loc, no, mode); + return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, r_dist, r_loc, r_no, mode); } -int snapObjectsContext(bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode) +int snapObjectsContext(bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) { ScrArea *sa = CTX_wm_area(C); View3D *v3d = sa->spacedata.first; - return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, dist, loc, no, mode); + return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, r_dist, r_loc, r_no, mode); } /******************** PEELING *********************************/ @@ -1706,7 +1717,9 @@ static void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float n peel->flag = 0; } -static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels) +static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], + const float ray_start[3], const float ray_normal[3], const float UNUSED(mval[2]), + ListBase *depth_peels) { int retval = 0; int totvert = dm->getNumVerts(dm); @@ -1814,7 +1827,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float return retval; } -static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, float mval[2]) +static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2]) { Base *base; int retval = 0; @@ -1895,12 +1908,12 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L return retval; } -int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, float mval[2]) +int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2]) { return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval); } -int peelObjectsContext(bContext *C, ListBase *depth_peels, float mval[2]) +int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2]) { ScrArea *sa = CTX_wm_area(C); View3D *v3d = sa->spacedata.first; From 4924abaad66acc966158b67f4843e12afde75352 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 01:10:05 +0000 Subject: [PATCH 171/203] replace fabs with fabsf where both input and output are floats. --- source/blender/blenkernel/intern/anim_sys.c | 8 ++++---- source/blender/blenkernel/intern/camera.c | 2 +- source/blender/blenkernel/intern/fcurve.c | 4 ++-- source/blender/blenkernel/intern/mball.c | 12 ++++++------ source/blender/blenkernel/intern/nla.c | 4 ++-- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenlib/intern/math_geom.c | 12 ++++++------ source/blender/blenlib/intern/math_rotation.c | 4 ++-- source/blender/editors/interface/view2d_ops.c | 4 ++-- source/blender/python/generic/noise_py_api.c | 18 +++++++++--------- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 63ab74fc105..b32421a6b3d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap, static float nlastrip_get_influence (NlaStrip *strip, float cframe) { /* sanity checks - normalise the blendin/out values? */ - strip->blendin= (float)fabs(strip->blendin); - strip->blendout= (float)fabs(strip->blendout); + strip->blendin= fabsf(strip->blendin); + strip->blendout= fabsf(strip->blendout); /* result depends on where frame is in respect to blendin/out values */ if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) { /* there is some blend-in */ - return (float)fabs(cframe - strip->start) / (strip->blendin); + return fabsf(cframe - strip->start) / (strip->blendin); } else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) { /* there is some blend-out */ - return (float)fabs(strip->end - cframe) / (strip->blendout); + return fabsf(strip->end - cframe) / (strip->blendout); } else { /* in the middle of the strip, we should be full strength */ diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index a8b1c2aa04f..b0c91e76b8c 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -158,7 +158,7 @@ float object_camera_dof_distance(Object *ob) normalize_m4(obmat); invert_m4_m4(imat, obmat); mul_m4_m4m4(mat, cam->dof_ob->obmat, imat); - return (float)fabs(mat[3][2]); + return fabsf(mat[3][2]); } return cam->YF_dofdist; } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 4bb9dc47fda..d01e3de0796 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1707,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4) * - len2 = length of handle of end key */ len= v4[0]- v1[0]; - len1= (float)fabs(h1[0]); - len2= (float)fabs(h2[0]); + len1= fabsf(h1[0]); + len2= fabsf(h2[0]); /* if the handles have no length, no need to do any corrections */ if ((len1+len2) == 0.0f) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index d8628e526ef..3e3f16dcfa3 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ calc_mballco(mainb[a], vec); - size= (float)fabs( vec[0] ); + size= fabsf( vec[0] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[1] ); + size= fabsf( vec[1] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[2] ); + size= fabsf( vec[2] ); if( size > totsize ) totsize= size; vec[0]= mainb[a]->x - mainb[a]->rad; @@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ calc_mballco(mainb[a], vec); - size= (float)fabs( vec[0] ); + size= fabsf( vec[0] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[1] ); + size= fabsf( vec[1] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[2] ); + size= fabsf( vec[2] ); if( size > totsize ) totsize= size; } diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 8a908097862..fd184b9def4 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short /* scaling */ if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f; - scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */ + scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */ /* length of referenced action */ actlength = strip->actend - strip->actstart; @@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip) short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max) { const float stripLen= (strip) ? strip->end - strip->start : 0.0f; - const float boundsLen= (float)fabs(max - min); + const float boundsLen= fabsf(max - min); /* sanity checks */ if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f)) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index dedf2675ff6..3c0a82667a8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1901,7 +1901,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ int a; // include framerate - fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) ); + fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) ); if(fac1 >= 1.0f) return 0; fac2= 1.0f-fac1; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 6fc3891d1bd..1170e44b27b 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3]) int a, px=0, py=1; /* first: find dominant axis: 0==X, 1==Y, 2==Z */ - x= (float)fabs(normal[0]); - y= (float)fabs(normal[1]); - z= (float)fabs(normal[2]); + x= fabsf(normal[0]); + y= fabsf(normal[1]); + z= fabsf(normal[2]); max = MAX3(x, y, z); if(max==y) py=2; else if(max==x) { @@ -1689,9 +1689,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float /* find best projection of face XY, XZ or YZ: barycentric weights of the 2d projected coords are the same and faster to compute */ - xn= (float)fabs(n[0]); - yn= (float)fabs(n[1]); - zn= (float)fabs(n[2]); + xn= fabsf(n[0]); + yn= fabsf(n[1]); + zn= fabsf(n[2]); if(zn>=xn && zn>=yn) {i= 0; j= 1;} else if(yn>=xn && yn>=zn) {i= 0; j= 2;} else {i= 1; j= 2;} diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 1637cd16161..e4664798f5d 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma compatible_eul(eul1, oldrot); compatible_eul(eul2, oldrot); - d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]); - d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]); + d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]); + d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]); /* return best, which is just the one with lowest difference */ if (d1 > d2) diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 998e70d5e25..5706da93fe9 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -985,12 +985,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* x-axis transform */ dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f; - dx= 1.0f - ((float)fabs(vzd->lastx - dist) + 2.0f) / ((float)fabs(event->x - dist) + 2.0f); + dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f); dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin); /* y-axis transform */ dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f; - dy= 1.0f - ((float)fabs(vzd->lasty - dist) + 2.0f) / ((float)fabs(event->y - dist) + 2.0f); + dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f); dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin); } else { diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index c84aab83b7e..902e64eb7c1 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, amp = 1.f; out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); if (hard) - out = (float)fabs(out); + out = fabsf(out); for (i = 1; i < oct; i++) { amp *= ampscale; x *= freqscale; @@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, z *= freqscale; t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f)); if (hard) - t = (float)fabs(t); + t = fabsf(t); out += t; } return out; @@ -321,16 +321,16 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) /* Turbulence Vector */ static void vTurb(float x, float y, float z, int oct, int hard, int nb, - float ampscale, float freqscale, float v[3]) + float ampscale, float freqscale, float v[3]) { float amp, t[3]; int i; amp = 1.f; noise_vector(x, y, z, nb, v); if (hard) { - v[0] = (float)fabs(v[0]); - v[1] = (float)fabs(v[1]); - v[2] = (float)fabs(v[2]); + v[0] = fabsf(v[0]); + v[1] = fabsf(v[1]); + v[2] = fabsf(v[2]); } for (i = 1; i < oct; i++) { amp *= ampscale; @@ -339,9 +339,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, z *= freqscale; noise_vector(x, y, z, nb, t); if (hard) { - t[0] = (float)fabs(t[0]); - t[1] = (float)fabs(t[1]); - t[2] = (float)fabs(t[2]); + t[0] = fabsf(t[0]); + t[1] = fabsf(t[1]); + t[2] = fabsf(t[2]); } v[0] += amp * t[0]; v[1] += amp * t[1]; From f3613be1fbfd764d829188b56ac17a3987161a77 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 01:24:40 +0000 Subject: [PATCH 172/203] add poll function for VIEW3D_OT_camera_to_view_selected & remove some unused code. also made it so copying camera sets the dof object to extern. --- source/blender/blenkernel/BKE_object.h | 1 - source/blender/blenkernel/intern/camera.c | 5 +++- source/blender/blenkernel/intern/object.c | 9 +----- .../editors/space_view3d/view3d_view.c | 28 +++++++++++++++---- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index cb79c7a7290..5eb9529b2fc 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -94,7 +94,6 @@ void object_to_mat3(struct Object *ob, float mat[][3]); void object_to_mat4(struct Object *ob, float mat[][4]); void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent); -void set_no_parent_ipo(int val); struct Object *object_pose_armature_get(struct Object *ob); void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index b0c91e76b8c..1bfeea727ec 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -74,7 +74,9 @@ Camera *copy_camera(Camera *cam) Camera *camn; camn= copy_libblock(&cam->id); - + + id_lib_extern((ID *)camn->dof_ob); + return camn; } @@ -454,6 +456,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data) } /* dont move the camera, just yield the fit location */ +/* only valid for perspective cameras */ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3]) { float shift[2]; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3c0a82667a8..51e3dc78e9b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1887,13 +1887,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4]) } } -// XXX what the hell is this? -static int no_parent_ipo=0; -void set_no_parent_ipo(int val) -{ - no_parent_ipo= val; -} - static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) { float *fp1, *fp2; @@ -1933,7 +1926,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) /* hurms, code below conflicts with depgraph... (ton) */ /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */ - if(no_parent_ipo==0 && stime != par->ctime) { + if(stime != par->ctime) { // only for ipo systems? Object tmp= *par; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index c416a60e410..bb268203a33 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -342,7 +342,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) +static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -369,7 +369,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) } -static int view3d_setcameratoview_poll(bContext *C) +static int view3d_camera_to_view_poll(bContext *C) { View3D *v3d= CTX_wm_view3d(C); if(v3d && v3d->camera && v3d->camera->id.lib==NULL) { @@ -390,8 +390,8 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot) ot->idname= "VIEW3D_OT_camera_to_view"; /* api callbacks */ - ot->exec= view3d_setcameratoview_exec; - ot->poll= view3d_setcameratoview_poll; + ot->exec= view3d_camera_to_view_exec; + ot->poll= view3d_camera_to_view_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -431,6 +431,24 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o } } +static int view3d_camera_to_view_selected_poll(bContext *C) +{ + View3D *v3d= CTX_wm_view3d(C); + if(v3d && v3d->camera && v3d->camera->id.lib==NULL) { + RegionView3D *rv3d= CTX_wm_region_view3d(C); + if(rv3d) { + if (rv3d->is_persp == FALSE) { + CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view"); + } + else if (!rv3d->viewlock) { + return 1; + } + } + } + + return 0; +} + void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) { /* identifiers */ @@ -440,7 +458,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec= view3d_camera_to_view_selected_exec; - // ot->poll= view3d_setcameratoview_poll; + ot->poll= view3d_camera_to_view_selected_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; From 822d6ae037e0cce734916e88ed00fdbd811edae1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 02:48:09 +0000 Subject: [PATCH 173/203] - rename MovieTrackingMarker.enabled --> mute, to match constraints/nla/fcurves/sequencer - report an error if an invalid BGpic arg is given to v3d.background_images.remove() --- source/blender/makesrna/intern/rna_space.c | 13 +++++++++---- source/blender/makesrna/intern/rna_tracking.c | 6 +++--- source/gameengine/Ketsji/BL_Shader.cpp | 9 ++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 393ffa69cbc..a33622cf8a1 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -900,11 +900,15 @@ static BGpic *rna_BackgroundImage_new(View3D *v3d) return bgpic; } -static void rna_BackgroundImage_remove(View3D *v3d, BGpic *bgpic) +static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, BGpic *bgpic) { - ED_view3D_background_image_remove(v3d, bgpic); - - WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d); + if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) { + BKE_report(reports, RPT_ERROR, "BackgroundImage can't be removed"); + } + else { + ED_view3D_background_image_remove(v3d, bgpic); + WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d); + } } /* Space Node Editor */ @@ -1321,6 +1325,7 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "remove", "rna_BackgroundImage_remove"); RNA_def_function_ui_description(func, "Remove background image"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 73b2914fba1..269860e1d7e 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -451,9 +451,9 @@ static void rna_def_trackingMarker(BlenderRNA *brna) RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); /* enable */ - prop= RNA_def_property(srna, "enable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_DISABLED); - RNA_def_property_ui_text(prop, "Enable", "Is marker enabled for current frame"); + prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED); + RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame"); RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL); } diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 682b42cc3cf..b1e3737af07 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -1362,14 +1362,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" ) int attr=0; - if(!PyArg_ParseTuple(args, "i:setAttrib", &attr )) + if(!PyArg_ParseTuple(args, "i:setAttrib", &attr)) return NULL; - + + attr= SHD_TANGENT; /* user input is ignored for now, there is only 1 attr */ + if(mShader==0) { PyErr_SetString(PyExc_ValueError, "shader.setAttrib() BL_Shader, invalid shader object"); return NULL; } - mAttr=SHD_TANGENT; /* What the heck is going on here - attr is just ignored??? - Campbell */ + + mAttr= attr; glUseProgramObjectARB(mShader); glBindAttribLocationARB(mShader, mAttr, "Tangent"); Py_RETURN_NONE; From ddf207b7c3d1cafb0485da268608b1fc875c13f0 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 19 Nov 2011 12:21:15 +0000 Subject: [PATCH 174/203] More UI messages fixes and tweaks (found while translating in french). --- source/blender/makesrna/intern/rna_actuator.c | 2 +- .../blender/makesrna/intern/rna_constraint.c | 66 +++++++++---------- .../blender/makesrna/intern/rna_controller.c | 2 +- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index b941e9ebed7..392aa6a7f5a 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -626,7 +626,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack"); + RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "layer", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 0cd36eb3755..4ab14550fd1 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -367,7 +367,7 @@ static void rna_def_constraint_childof(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Child Of Constraint", "Creates constraint-based parent-child relationship"); + RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship"); RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -440,7 +440,7 @@ static void rna_def_constraint_python(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "PythonConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Python Constraint", "Uses Python script for constraint evaluation"); + RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation"); RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data"); prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); @@ -641,7 +641,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Track To Constraint", "Aims the constrained object toward the target"); + RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -685,7 +685,7 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target"); + RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -748,7 +748,7 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copies the rotation of the target"); + RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target"); RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -804,7 +804,7 @@ static void rna_def_constraint_size_like(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target"); + RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target"); RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -852,7 +852,7 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintains a constant volume along a single scaling axis"); + RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis"); RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data"); prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE); @@ -874,7 +874,7 @@ static void rna_def_constraint_transform_like(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copies all the transforms of the target"); + RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -910,7 +910,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FloorConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Floor Constraint", "Uses the target object for location limitation"); + RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation"); RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -1038,7 +1038,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Points toward the target along the track axis, while locking the other axis"); + RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -1092,7 +1092,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Locks motion to the target path"); + RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path"); RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -1137,7 +1137,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS); - RNA_def_property_ui_text(prop, "Curve Radius", "Objects scale by the curve radius"); + RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } @@ -1159,7 +1159,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretches to meet the target object"); + RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -1209,9 +1209,9 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem pivot_items[] = { - {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allows rotations around all axes"}, - {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Works in one plane, allows rotations around one axis only"}, - {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allows rotations around all axes with limits for the cone and twist axes"}, + {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"}, + {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"}, + {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"}, {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"}, {0, NULL, 0, NULL, NULL}}; @@ -1343,7 +1343,7 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) /* Limit Booleans */ prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 1); - RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum x limit"); + RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); @@ -1358,17 +1358,17 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 8); - RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit"); + RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 16); - RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum y angular limit"); + RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 32); - RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit"); + RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } @@ -1403,7 +1403,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC); - RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box"); + RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } @@ -1553,7 +1553,7 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limits the location of the constrained object"); + RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object"); RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data"); prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE); @@ -1634,7 +1634,7 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object"); + RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object"); RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data"); prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); @@ -1700,7 +1700,7 @@ static void rna_def_constraint_size_limit(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limits the scaling of the constrained object"); + RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object"); RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data"); prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE); @@ -1781,7 +1781,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object"); + RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -1825,13 +1825,13 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem type_items[] = { - {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrinks the location to the nearest target surface"}, - {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the location to the nearest target surface along a given axis"}, - {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the location to the nearest target vertex"}, + {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"}, + {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"}, + {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship"); + RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship"); RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); @@ -1844,7 +1844,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "shrinkType"); RNA_def_property_enum_items(prop, type_items); - RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position"); + RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); @@ -1884,7 +1884,7 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Points toward target by taking the shortest rotation path"); + RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path"); prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, "bConstraint", "headtail"); @@ -2039,7 +2039,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track"); + RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track"); RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data"); /* movie clip */ @@ -2074,7 +2074,7 @@ static void rna_def_constraint_camera_solver(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the reconstructed camera movenment"); + RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the reconstructed camera movement"); RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data"); /* movie clip */ diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 89239c10ffd..5278c1e3532 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -258,7 +258,7 @@ void RNA_def_controller(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used"); + RNA_def_property_ui_text(prop, "Module", "Module name and function to run, e.g. \"someModule.main\" (internal texts and external python files can be used)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE); From d9e99abe3753591d510dbb58813bbc29e3381b57 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 16:17:35 +0000 Subject: [PATCH 175/203] hide overly picky warnings from 'pylint' for pep8 script, indentation edits. --- build_files/cmake/project_info.py | 9 +- build_files/scons/config/darwin-config.py | 178 +++++++++--------- build_files/scons/config/freebsd7-config.py | 4 +- build_files/scons/config/freebsd8-config.py | 4 +- build_files/scons/config/freebsd9-config.py | 4 +- build_files/scons/config/linux-config.py | 4 +- build_files/scons/tools/Blender.py | 28 +-- doc/python_api/epy/testbgl.py | 45 ----- release/scripts/modules/animsys_refactor.py | 2 +- .../scripts/startup/bl_ui/space_sequencer.py | 6 +- release/scripts/startup/bl_ui/space_view3d.py | 2 +- source/tests/pep8.py | 27 ++- 12 files changed, 145 insertions(+), 168 deletions(-) delete mode 100644 doc/python_api/epy/testbgl.py diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index dca41849a49..65afd109302 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -149,10 +149,11 @@ def cmake_advanced_info(): from xml.dom.minidom import parse tree = parse(join(CMAKE_DIR, ".cproject")) - ''' - f = open(".cproject_pretty", 'w') - f.write(tree.toprettyxml(indent=" ", newl="")) - ''' + + # to check on nicer xml + # f = open(".cproject_pretty", 'w') + # f.write(tree.toprettyxml(indent=" ", newl="")) + ELEMENT_NODE = tree.ELEMENT_NODE cproject, = tree.getElementsByTagName("cproject") diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index d6da908f074..028b1bd0289 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -18,20 +18,20 @@ MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64 cmd = 'uname -p' -MAC_PROC=commands.getoutput(cmd) +MAC_PROC=commands.getoutput(cmd) cmd = 'uname -r' -cmd_res=commands.getoutput(cmd) +cmd_res=commands.getoutput(cmd) if cmd_res[:1]=='7': - MAC_CUR_VER='10.3' + MAC_CUR_VER='10.3' elif cmd_res[:1]=='8': - MAC_CUR_VER='10.4' + MAC_CUR_VER='10.4' elif cmd_res[:1]=='9': - MAC_CUR_VER='10.5' + MAC_CUR_VER='10.5' elif cmd_res[:2]=='10': - MAC_CUR_VER='10.6' + MAC_CUR_VER='10.6' elif cmd_res[:2]=='11': - MAC_CUR_VER='10.7' + MAC_CUR_VER='10.7' cmd = 'xcodebuild -version' cmd_xcode=commands.getoutput(cmd) XCODE_CUR_VER=cmd_xcode @@ -40,7 +40,7 @@ cmd_sdk=commands.getoutput(cmd) MACOSX_SDK_CHECK=cmd_sdk if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64': - USE_QTKIT=True # Carbon quicktime is not available for 64bit + USE_QTKIT=True # Carbon quicktime is not available for 64bit # Default target OSX settings per architecture @@ -48,41 +48,41 @@ if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64': if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4': # all releases are now made for 10.5 ! -# MAC_MIN_VERS = '10.3' -# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk' -# LCGDIR = '#../lib/darwin-6.1-powerpc' -# CC = 'gcc-3.3' -# CXX = 'g++-3.3' - MAC_MIN_VERS = '10.4' - MACOSX_DEPLOYMENT_TARGET = '10.4' - MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk' - LCGDIR = '#../lib/darwin-8.0.0-powerpc' - CC = 'gcc-4.0' - CXX = 'g++-4.0' +# MAC_MIN_VERS = '10.3' +# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk' +# LCGDIR = '#../lib/darwin-6.1-powerpc' +# CC = 'gcc-3.3' +# CXX = 'g++-3.3' + MAC_MIN_VERS = '10.4' + MACOSX_DEPLOYMENT_TARGET = '10.4' + MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk' + LCGDIR = '#../lib/darwin-8.0.0-powerpc' + CC = 'gcc-4.0' + CXX = 'g++-4.0' elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4': - MAC_MIN_VERS = '10.4' - MACOSX_DEPLOYMENT_TARGET = '10.4' - MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk' - LCGDIR = '#../lib/darwin-8.x.i386' - CC = 'gcc-4.0' - CXX = 'g++-4.0' + MAC_MIN_VERS = '10.4' + MACOSX_DEPLOYMENT_TARGET = '10.4' + MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk' + LCGDIR = '#../lib/darwin-8.x.i386' + CC = 'gcc-4.0' + CXX = 'g++-4.0' else : - if 'Mac OS X 10.5' in MACOSX_SDK_CHECK: - # OSX 10.5/6 with Xcode 3.x - MAC_MIN_VERS = '10.5' - MACOSX_DEPLOYMENT_TARGET = '10.5' - MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk' - LCGDIR = '#../lib/darwin-9.x.universal' - CC = 'gcc-4.2' - CXX = 'g++-4.2' - else: - # OSX 10.6/7 with Xcode 4.x - MAC_MIN_VERS = '10.6' - MACOSX_DEPLOYMENT_TARGET = '10.6' - MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk' - LCGDIR = '#../lib/darwin-9.x.universal' - CC = 'gcc-4.2' - CXX = 'g++-4.2' + if 'Mac OS X 10.5' in MACOSX_SDK_CHECK: + # OSX 10.5/6 with Xcode 3.x + MAC_MIN_VERS = '10.5' + MACOSX_DEPLOYMENT_TARGET = '10.5' + MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk' + LCGDIR = '#../lib/darwin-9.x.universal' + CC = 'gcc-4.2' + CXX = 'g++-4.2' + else: + # OSX 10.6/7 with Xcode 4.x + MAC_MIN_VERS = '10.6' + MACOSX_DEPLOYMENT_TARGET = '10.6' + MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk' + LCGDIR = '#../lib/darwin-9.x.universal' + CC = 'gcc-4.2' + CXX = 'g++-4.2' LIBDIR = '${LCGDIR}' @@ -109,32 +109,32 @@ BF_PYTHON_VERSION = '3.2' WITH_OSX_STATICPYTHON = True if WITH_OSX_STATICPYTHON: - # python 3.2 uses precompiled libraries in bf svn /lib by default + # python 3.2 uses precompiled libraries in bf svn /lib by default - BF_PYTHON = LIBDIR + '/python' - BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' - # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' - BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' - BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}' - # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System'] + BF_PYTHON = LIBDIR + '/python' + BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' + # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' + BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' + BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}' + # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System'] else: - # python 3.2 uses Python-framework additionally installed in /Library/Frameworks - - BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/' - BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m' - BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}' - #BF_PYTHON_LIB = '' - BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m' - + # python 3.2 uses Python-framework additionally installed in /Library/Frameworks + + BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/' + BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m' + BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}' + #BF_PYTHON_LIB = '' + BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m' + WITH_BF_OPENAL = True #different lib must be used following version of gcc # for gcc 3.3 #BF_OPENAL = LIBDIR + '/openal' # for gcc 3.4 and ulterior if MAC_PROC == 'powerpc': - BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal' + BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal' else : - BF_OPENAL = LIBDIR + '/openal' + BF_OPENAL = LIBDIR + '/openal' WITH_BF_STATICOPENAL = False BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!! @@ -233,7 +233,7 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib' #WITH_BF_NSPR = True #BF_NSPR = $(LIBDIR)/nspr #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -#BF_NSPR_LIB = +#BF_NSPR_LIB = # Uncomment the following line to use Mozilla inplace of netscape #CPPFLAGS += -DMOZ_NOT_NET @@ -284,7 +284,7 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib' #BF_EXPAT_LIBPATH = '/usr/lib' #Cycles -WITH_BF_CYCLES = True +WITH_BF_CYCLES = True WITH_BF_OIIO = True BF_OIIO = LIBDIR + '/openimageio' @@ -318,9 +318,9 @@ WITH_BF_3DMOUSE = True BF_QUIET = '1' # suppress verbose output if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64': - ARCH_FLAGS = ['-m64'] + ARCH_FLAGS = ['-m64'] else: - ARCH_FLAGS = ['-m32'] + ARCH_FLAGS = ['-m32'] CFLAGS = [] CXXFLAGS = [] @@ -329,53 +329,53 @@ CCFLAGS = ['-pipe','-funsigned-char'] CPPFLAGS = list(ARCH_FLAGS) if WITH_GHOST_COCOA: - PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS + PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS else: - PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS + PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS if WITH_BF_QUICKTIME: - if USE_QTKIT: - PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit'] - else: - PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime'] + if USE_QTKIT: + PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit'] + else: + PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime'] if not WITH_OSX_STATICPYTHON: - PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python'] + PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python'] #note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore) if MACOSX_DEPLOYMENT_TARGET == '10.7': - LLIBS = ['stdc++'] + LLIBS = ['stdc++'] else: - LLIBS = ['stdc++', 'SystemStubs'] + LLIBS = ['stdc++', 'SystemStubs'] # some flags shuffling for different OS versions if MAC_MIN_VERS == '10.3': - CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS - PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS - LLIBS.append('crt3.o') - -if USE_SDK: - SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE] - PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS - CCFLAGS=SDK_FLAGS+CCFLAGS - CXXFLAGS=SDK_FLAGS+CXXFLAGS + CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS + PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS + LLIBS.append('crt3.o') -#Intel Macs are CoreDuo and Up +if USE_SDK: + SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE] + PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS + CCFLAGS=SDK_FLAGS+CCFLAGS + CXXFLAGS=SDK_FLAGS+CXXFLAGS + +#Intel Macs are CoreDuo and Up if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64': - REL_CFLAGS = [] - REL_CXXFLAGS = [] - REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] + REL_CFLAGS = [] + REL_CXXFLAGS = [] + REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] else: - CCFLAGS += ['-fno-strict-aliasing'] - REL_CFLAGS = [] - REL_CXXFLAGS = [] - REL_CCFLAGS = ['-DNDEBUG', '-O2'] + CCFLAGS += ['-fno-strict-aliasing'] + REL_CFLAGS = [] + REL_CXXFLAGS = [] + REL_CCFLAGS = ['-DNDEBUG', '-O2'] # Intel 64bit Macs are Core2Duo and up if MACOSX_ARCHITECTURE == 'x86_64': - REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads'] + REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads'] CC_WARN = ['-Wall'] C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes'] diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index ed99ac6e094..bf778061f0f 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL CPPFLAGS = [] CXXFLAGS = [] if WITH_BF_FFMPEG: - # libavutil needs UINT64_C() - CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] + # libavutil needs UINT64_C() + CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] REL_CFLAGS = [] REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index c62b30a7a56..738f14ab973 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL CPPFLAGS = [] CXXFLAGS = [] if WITH_BF_FFMPEG: - # libavutil needs UINT64_C() - CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] + # libavutil needs UINT64_C() + CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] REL_CFLAGS = [] REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index c16795929f2..f40fc33646e 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -175,8 +175,8 @@ CXXFLAGS = [] CPPFLAGS = [] if WITH_BF_FFMPEG: - # libavutil needs UINT64_C() - CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] + # libavutil needs UINT64_C() + CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] REL_CFLAGS = [] REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index af5f73fb87c..b25bf98c9e6 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -247,8 +247,8 @@ CPPFLAGS = [] # g++ 4.6, only needed for bullet CXXFLAGS += ['-fpermissive'] if WITH_BF_FFMPEG: - # libavutil needs UINT64_C() - CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] + # libavutil needs UINT64_C() + CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] REL_CFLAGS = [] REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 4f447ce6240..f9a9023c5ce 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -258,9 +258,9 @@ def setup_syslibs(lenv): if lenv['WITH_BF_OGG']: syslibs += Split(lenv['BF_OGG_LIB']) if lenv['WITH_BF_JACK']: - syslibs += Split(lenv['BF_JACK_LIB']) + syslibs += Split(lenv['BF_JACK_LIB']) if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']: - syslibs += Split(lenv['BF_SNDFILE_LIB']) + syslibs += Split(lenv['BF_SNDFILE_LIB']) if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']: syslibs += Split(lenv['BF_FFTW3_LIB']) if lenv['WITH_BF_SDL']: @@ -764,17 +764,17 @@ class BlenderEnvironment(SConsEnvironment): lenv.Append(CPPPATH=includes) lenv.Append(CPPDEFINES=defines) if lenv['BF_DEBUG'] or (libname in quickdebug): - lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS']) + lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS']) + lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS']) + lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS']) else: - lenv.Append(CFLAGS = lenv['REL_CFLAGS']) - lenv.Append(CCFLAGS = lenv['REL_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS']) + lenv.Append(CFLAGS = lenv['REL_CFLAGS']) + lenv.Append(CCFLAGS = lenv['REL_CCFLAGS']) + lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS']) if lenv['BF_PROFILE']: - lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS']) + lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS']) + lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS']) + lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS']) if compileflags: lenv.Replace(CFLAGS = compileflags) if cc_compileflags: @@ -834,7 +834,7 @@ class BlenderEnvironment(SConsEnvironment): if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) if lenv['CXX'].endswith('CC'): - lenv.Replace(LINK = '$CXX') + lenv.Replace(LINK = '$CXX') if lenv['OURPLATFORM']=='darwin': if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) @@ -846,8 +846,8 @@ class BlenderEnvironment(SConsEnvironment): lenv.Append(LIBPATH=libpath) lenv.Append(LIBS=libs) if lenv['WITH_BF_QUICKTIME']: - lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB']) - lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH']) + lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB']) + lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH']) prog = lenv.Program(target=builddir+'bin/'+progname, source=sources) if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']: f = lenv.File(progname + '.bsc', builddir) diff --git a/doc/python_api/epy/testbgl.py b/doc/python_api/epy/testbgl.py deleted file mode 100644 index e895d01df69..00000000000 --- a/doc/python_api/epy/testbgl.py +++ /dev/null @@ -1,45 +0,0 @@ -# Testing the BGL module - -import Blender -from Blender.BGL import * -from Blender import Draw - -R = G = B = 0 -A = 1 - -instructions = "Hold mouse buttons to change the background color." -quitting = " Press ESC or q to quit." - -def show_win(): - glClearColor(R,G,B,A) # define color used to clear buffers - glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer - glColor3f(1,1,1) # change default color - glRasterPos2i(50,100) # move cursor to x = 50, y = 100 - Draw.Text("Testing BGL + Draw") # draw this text there - glRasterPos2i(350,20) # move cursor again - Draw.Text(instructions + quitting) # draw another msg - glBegin(GL_LINE_LOOP) # begin a vertex-data list - glVertex2i(46,92) - glVertex2i(120,92) - glVertex2i(120,115) - glVertex2i(46,115) - glEnd() # close this list - glColor3f(0.35,0.18,0.92) # change default color again - glBegin(GL_POLYGON) # another list, for a polygon - glVertex2i(315, 292) - glVertex2i(412, 200) - glVertex2i(264, 256) - glEnd() - Draw.Redraw(1) # make changes visible. - -def ev(evt, val): # this is a callback for Draw.Register() - global R,G,B,A # it handles input events - if evt == Draw.ESCKEY or evt == Draw.QKEY: - Draw.Exit() # this quits the script - elif evt == Draw.LEFTMOUSE: R = 1 - R - elif evt == Draw.MIDDLEMOUSE: G = 1 - G - elif evt == Draw.RIGHTMOUSE: B = 1 - B - else: - Draw.Register(show_win, ev, None) - -Draw.Register(show_win, ev, None) # start the main loop diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 64110b0f620..f97ba3c2a50 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -35,9 +35,9 @@ def drepr(string): class DataPathBuilder(object): - __slots__ = ("data_path", ) """ Dummy class used to parse fcurve and driver data paths. """ + __slots__ = ("data_path", ) def __init__(self, attrs): self.data_path = attrs diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index c1c9bc12b2d..06f481d2993 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -473,9 +473,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): if strip.type == 'SPEED': col.prop(strip, "multiply_speed") elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}: - col.prop(strip, "use_default_fade", "Default fade") - if not strip.use_default_fade: - col.prop(strip, "effect_fader", text="Effect fader") + col.prop(strip, "use_default_fade", "Default fade") + if not strip.use_default_fade: + col.prop(strip, "effect_fader", text="Effect fader") layout.prop(strip, "use_translation", text="Image Offset:") if strip.use_translation: diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index a2a4405f77a..15c04442142 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -525,7 +525,7 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES' layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS' if context.scene.tool_settings.mesh_select_mode[2] == False: - layout.operator("mesh.select_non_manifold", text="Non Manifold") + layout.operator("mesh.select_non_manifold", text="Non Manifold") layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER' layout.operator("mesh.select_similar", text="Similar") diff --git a/source/tests/pep8.py b/source/tests/pep8.py index f7c416553b2..0c7c90a2382 100644 --- a/source/tests/pep8.py +++ b/source/tests/pep8.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# +# import os @@ -37,6 +37,7 @@ import os # should be directly after the licence header, ~20 in most cases PEP8_SEEK_COMMENT = 40 SKIP_PREFIX = "./tools", "./config", "./scons", "./extern" +FORCE_PEP8_ALL = False def file_list_py(path): @@ -75,7 +76,7 @@ def main(): if [None for prefix in SKIP_PREFIX if f.startswith(prefix)]: continue - pep8_type = is_pep8(f) + pep8_type = FORCE_PEP8_ALL or is_pep8(f) if pep8_type: # so we can batch them for each tool. @@ -112,7 +113,27 @@ def main(): print("\n\n\n# running pylint...") for f, pep8_type in files: # let pep8 complain about line length - os.system("pylint --reports=n --max-line-length=1000 '%s'" % f) + os.system("pylint " + "--disable=" + "C0111," # missing docstring + "C0103," # invalid name + "W0613," # unused argument, may add this back + # but happens a lot for 'context' for eg. + "W0232," # class has no __init__, Operator/Panel/Menu etc + "W0142," # Used * or ** magic + # even needed in some cases + "R0903," # bake_action] Too many statements (68/50) + "R0911," # Too many return statements + "R0912," # Too many branches + "R0913," # Too many arguments + "R0914," # Too many local variables + "R0915," # bake_action] Too many statements (68/50) + " " + "--include-ids=y " + "--output-format=parseable " + "--reports=n " + "--max-line-length=1000" + " '%s'" % f) if __name__ == "__main__": main() From 5d2a155f2bcc2d6d77d3a3753c23027b06942540 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 19 Nov 2011 18:35:42 +0000 Subject: [PATCH 176/203] Camera: some more refactoring, mostly in the function that computes the camera border, now we just get the border coordinates from comparing the viewport and camera viewplanes. --- source/blender/blenkernel/BKE_camera.h | 8 +- source/blender/blenkernel/intern/camera.c | 34 ++++--- source/blender/editors/gpencil/drawgpencil.c | 2 +- source/blender/editors/gpencil/gpencil_edit.c | 2 +- .../blender/editors/gpencil/gpencil_paint.c | 2 +- source/blender/editors/include/ED_view3d.h | 3 +- .../editors/sculpt_paint/paint_image.c | 3 +- .../editors/space_view3d/view3d_draw.c | 99 +++++++------------ .../editors/space_view3d/view3d_edit.c | 4 +- .../editors/space_view3d/view3d_intern.h | 1 - .../editors/space_view3d/view3d_view.c | 12 +-- .../blender/modifiers/intern/MOD_uvproject.c | 14 +-- .../blender/render/intern/source/initrender.c | 6 +- 13 files changed, 86 insertions(+), 104 deletions(-) diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 8aec576b963..72e22dc1583 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -92,20 +92,22 @@ typedef struct CameraParams { int field_second; int field_odd; - /* compute result */ + /* computed viewplane */ float ycor; - float viewdx; float viewdy; rctf viewplane; + /* computed matrix */ float winmat[4][4]; } CameraParams; void camera_params_init(CameraParams *params); void camera_params_from_object(CameraParams *params, struct Object *camera); void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d); -void camera_params_compute(CameraParams *params, int winx, int winy, float aspx, float aspy); + +void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy); +void camera_params_compute_matrix(CameraParams *params); /* Camera View Frame */ diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 1bfeea727ec..da7c0ab1774 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -241,7 +241,7 @@ void camera_params_from_object(CameraParams *params, Object *ob) void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d) { - /* perspective view */ + /* common */ params->lens= v3d->lens; params->clipsta= v3d->near; params->clipend= v3d->far; @@ -250,28 +250,32 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D * /* camera view */ camera_params_from_object(params, v3d->camera); - params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 2.0f; + params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom); + + params->offsetx= 2.0f*rv3d->camdx*params->zoom; + params->offsety= 2.0f*rv3d->camdy*params->zoom; + + params->shiftx *= params->zoom; + params->shifty *= params->zoom; + params->zoom= 1.0f/params->zoom; - - params->offsetx= rv3d->camdx; - params->offsety= rv3d->camdy; - - params->shiftx *= 0.5f; - params->shifty *= 0.5f; } else if(rv3d->persp==RV3D_ORTHO) { /* orthographic view */ params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality params->clipsta= - params->clipend; - params->is_ortho= 1; + params->is_ortho= TRUE; params->ortho_scale = rv3d->dist; + params->zoom= 2.0f; + } + else { + /* perspective view */ + params->zoom= 2.0f; } - - params->zoom *= 2.0f; } -void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, float yasp) +void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp) { rctf viewplane; float pixsize, viewfac, sensor_size, dx, dy; @@ -344,6 +348,12 @@ void camera_params_compute(CameraParams *params, int winx, int winy, float xasp, params->viewdx= pixsize; params->viewdy= params->ycor * pixsize; params->viewplane= viewplane; +} + +/* viewplane is assumed to be already computed */ +void camera_params_compute_matrix(CameraParams *params) +{ + rctf viewplane= params->viewplane; /* compute projection matrix */ if(params->is_ortho) diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 081d604819d..def6cd61370 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -794,7 +794,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d) * deal with the camera border, otherwise map the coords to the camera border. */ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { rctf rectf; - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */ BLI_copy_rcti_rctf(&rect, &rectf); } else { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 65db5e27ed7..9a492153b7f 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -468,7 +468,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { Scene *scene= CTX_data_scene(C); - ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, TRUE); /* no shift */ return 1; } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 2dd8ef4da94..f09797bf6f1 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1258,7 +1258,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */ + ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, TRUE); /* no shift */ p->subrect= &p->subrect_data; } } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index a90e91a7242..c2390d41d8c 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -210,7 +210,8 @@ int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, floa int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend); void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); -void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift); +void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift); +void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]); /* drawobject.c iterators */ void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index a856f959b49..9b256acbca9 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3068,7 +3068,8 @@ static void project_paint_begin(ProjPaintState *ps) /* window matrix, clipping and ortho */ camera_params_init(¶ms); camera_params_from_object(¶ms, cam_ob); - camera_params_compute(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); + camera_params_compute_viewplane(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); + camera_params_compute_matrix(¶ms); copy_m4_m4(winmat, params.winmat); ps->clipsta= params.clipsta; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index cdd90b38d0a..7dae02aba39 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -923,75 +923,48 @@ static void draw_selected_name(Scene *scene, Object *ob) BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1); } -void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2]) +static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift, short no_zoom) { - float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp); - short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + CameraParams params; + rctf rect_view, rect_camera; - if(camob && camob->type==OB_CAMERA) { - Camera *cam= (Camera *)camob->data; - sensor_fit= cam->sensor_fit; - } + /* get viewport viewplane */ + camera_params_init(¶ms); + camera_params_from_view3d(¶ms, v3d, rv3d); + if(no_zoom) + params.zoom= 1.0f; + camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f); + rect_view= params.viewplane; - if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - float winmax= MAX2(ar->winx, ar->winy); + /* get camera viewplane */ + camera_params_init(¶ms); + camera_params_from_object(¶ms, v3d->camera); + if(no_shift) { + params.shiftx= 0.0f; + params.shifty= 0.0f; + } + camera_params_compute_viewplane(¶ms, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp); + rect_camera= params.viewplane; - if(aspect > 1.0f) { - size_r[0]= winmax; - size_r[1]= winmax/aspect; - } else { - size_r[0]= winmax*aspect; - size_r[1]= winmax; - } - } - else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { - size_r[0]= ar->winx; - size_r[1]= ar->winx/aspect; - } - else { - size_r[0]= ar->winy*aspect; - size_r[1]= ar->winy; - } + /* get camera border within viewport */ + viewborder_r->xmin= ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx; + viewborder_r->xmax= ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx; + viewborder_r->ymin= ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy; + viewborder_r->ymax= ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy; } -void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift) +void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2]) { - const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom); - float size[2]; - float dx= 0.0f, dy= 0.0f; - - view3d_viewborder_size_get(scene, v3d->camera, ar, size); + rctf viewborder; - size[0]= size[0]*zoomfac; - size[1]= size[1]*zoomfac; - - /* center in window */ - viewborder_r->xmin= 0.5f * ar->winx - 0.5f * size[0]; - viewborder_r->ymin= 0.5f * ar->winy - 0.5f * size[1]; - viewborder_r->xmax= viewborder_r->xmin + size[0]; - viewborder_r->ymax= viewborder_r->ymin + size[1]; - - dx= ar->winx*rv3d->camdx*zoomfac*2.0f; - dy= ar->winy*rv3d->camdy*zoomfac*2.0f; - - /* apply offset */ - viewborder_r->xmin-= dx; - viewborder_r->ymin-= dy; - viewborder_r->xmax-= dx; - viewborder_r->ymax-= dy; - - if(do_shift && v3d->camera && v3d->camera->type==OB_CAMERA) { - Camera *cam= v3d->camera->data; - float w = viewborder_r->xmax - viewborder_r->xmin; - float h = viewborder_r->ymax - viewborder_r->ymin; - float side = MAX2(w, h); + view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE); + size_r[0]= viewborder.xmax - viewborder.xmin; + size_r[1]= viewborder.ymax - viewborder.ymin; +} - if(do_shift == -1) side *= -1; - viewborder_r->xmin+= cam->shiftx*side; - viewborder_r->xmax+= cam->shiftx*side; - viewborder_r->ymin+= cam->shifty*side; - viewborder_r->ymax+= cam->shifty*side; - } +void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift) +{ + view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, FALSE); } static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac) @@ -2509,7 +2482,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in camera_params_init(¶ms); camera_params_from_object(¶ms, v3d->camera); - camera_params_compute(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); + camera_params_compute_viewplane(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); + camera_params_compute_matrix(¶ms); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat); } @@ -2568,7 +2542,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w camera_params_init(¶ms); camera_params_from_object(¶ms, v3d.camera); - camera_params_compute(¶ms, width, height, scene->r.xasp, scene->r.yasp); + camera_params_compute_viewplane(¶ms, width, height, scene->r.xasp, scene->r.yasp); + camera_params_compute_matrix(¶ms); copy_m4_m4(rv3d.winmat, params.winmat); v3d.near= params.clipsta; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 39ef6b3c84a..32e162fd09c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2266,7 +2266,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was rv3d->camdx= rv3d->camdy= 0.0f; - view3d_viewborder_size_get(scene, v3d->camera, ar, size); + ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size); /* 4px is just a little room from the edge of the area */ xfac= (float)ar->winx / (float)(size[0] + 4); @@ -2534,7 +2534,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d) float size[2]; int im_width= (scene->r.size*scene->r.xsch)/100; - view3d_viewborder_size_get(scene, v3d->camera, ar, size); + ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size); rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]); CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 775cb45066a..42f58ba26f7 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -140,7 +140,6 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void view3d_clr_clipping(void); void view3d_set_clipping(RegionView3D *rv3d); void add_view3d_after(ListBase *lb, Base *base, int flag); -void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]); void circf(float x, float y, float rad); void circ(float x, float y, float rad); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index bb268203a33..90f617513a5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -983,8 +983,8 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl camera_params_init(¶ms); camera_params_from_view3d(¶ms, v3d, rv3d); - *clipsta= params.clipsta; - *clipend= params.clipend; + if(clipsta) *clipsta= params.clipsta; + if(clipend) *clipend= params.clipend; return params.is_ortho; } @@ -996,11 +996,11 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, camera_params_init(¶ms); camera_params_from_view3d(¶ms, v3d, rv3d); - camera_params_compute(¶ms, winx, winy, 1.0f, 1.0f); + camera_params_compute_viewplane(¶ms, winx, winy, 1.0f, 1.0f); - *viewplane= params.viewplane; - *clipsta= params.clipsta; - *clipend= params.clipend; + if(viewplane) *viewplane= params.viewplane; + if(clipsta) *clipsta= params.clipsta; + if(clipend) *clipend= params.clipend; return params.is_ortho; } diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index df528a0cb11..6f0ba9259b8 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -195,20 +195,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, free_uci= 1; } else { - float sensor= (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : cam->sensor_x; + float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); + int sensor_fit= camera_sensor_fit(cam->sensor_fit, aspx, aspy); float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; - if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { - if(aspect > 1.0f) { - xmax = 0.5f * scale; - ymax = xmax / aspect; - } else { - ymax = 0.5f * scale; - xmax = ymax * aspect; - } - } - else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { xmax = 0.5f * scale; ymax = xmax / aspect; } diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index e7572302676..b7254cd1221 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -482,7 +482,8 @@ void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clips params.clipend= clipend; /* compute matrix, viewplane, .. */ - camera_params_compute(¶ms, re->winx, re->winy, 1.0f, 1.0f); + camera_params_compute_viewplane(¶ms, re->winx, re->winy, 1.0f, 1.0f); + camera_params_compute_matrix(¶ms); /* extract results */ re_camera_params_get(re, ¶ms, cam_ob); @@ -503,7 +504,8 @@ void RE_SetCamera(Render *re, Object *cam_ob) params.field_odd= (re->r.mode & R_ODDFIELD); /* compute matrix, viewplane, .. */ - camera_params_compute(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); + camera_params_compute_viewplane(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); + camera_params_compute_matrix(¶ms); /* extract results */ re_camera_params_get(re, ¶ms, cam_ob); From 120c0659ed24378bda02b03cac8854aa0c01283c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 19 Nov 2011 20:14:57 +0000 Subject: [PATCH 177/203] Camera tracking fixes: - Fixed incorrect memory access on distoritons more than 128 pixels - Do not use UNDO operators flags for delete proxy operator (files can't be restored form disk), and also do not use UNDO for set as background operator (background images are storing in 3d viewport which isn't getting re-loaded on undo which can lead to incorrect users count of movie clip user). --- .../libmv/simple_pipeline/camera_intrinsics.cc | 14 ++++---------- release/scripts/startup/bl_operators/clip.py | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc index 917f80e6926..ba88ce7676d 100644 --- a/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc +++ b/extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc @@ -24,7 +24,7 @@ namespace libmv { struct Offset { - signed char ix, iy; + short ix, iy; unsigned char fx,fy; }; @@ -201,20 +201,14 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub warp_y = warp_y*aspy + 0.5 * overscan * h; int ix = int(warp_x), iy = int(warp_y); int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256); - if(fx == 256) { fx=0; ix++; } - if(fy == 256) { fy=0; iy++; } // Use nearest border pixel if( ix < 0 ) { ix = 0, fx = 0; } if( iy < 0 ) { iy = 0, fy = 0; } if( ix >= width-2 ) ix = width-2; if( iy >= height-2 ) iy = height-2; - if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) { - Offset offset = { ix-x, iy-y, fx, fy }; - grid->offset[y*width+x] = offset; - } else { - Offset offset = { 0, 0, 0, 0 }; - grid->offset[y*width+x] = offset; - } + + Offset offset = { ix-x, iy-y, fx, fy }; + grid->offset[y*width+x] = offset; } } } diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index dc0d35062e6..6c2256dc08b 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -116,7 +116,7 @@ class CLIP_OT_delete_proxy(Operator): bl_idname = "clip.delete_proxy" bl_label = "Delete Proxy" - bl_options = {'UNDO', 'REGISTER'} + bl_options = {'REGISTER'} @classmethod def poll(cls, context): @@ -191,7 +191,7 @@ class CLIP_OT_set_viewport_background(Operator): bl_idname = "clip.set_viewport_background" bl_label = "Set as Background" - bl_options = {'UNDO', 'REGISTER'} + bl_options = {'REGISTER'} @classmethod def poll(cls, context): From 807a76d9430b6b6e30fd6f09d6000f093c37dea4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 19 Nov 2011 20:40:46 +0000 Subject: [PATCH 178/203] =?UTF-8?q?Fixing=20compile=20breakage=20(was=20mi?= =?UTF-8?q?ssing=20an=20#include=20"BKE=5Fcamera.h"=20in=20UVProject=20mod?= =?UTF-8?q?ifier=20code=20file=E2=80=A6).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/modifiers/intern/MOD_uvproject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 6f0ba9259b8..e3abc16f98f 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -46,6 +46,7 @@ #include "BLI_utildefines.h" +#include "BKE_camera.h" #include "BKE_DerivedMesh.h" #include "MOD_modifiertypes.h" From 7217518179d9ed0c2aeda835402ac019884ee461 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 19 Nov 2011 20:57:53 +0000 Subject: [PATCH 179/203] UI: * Add theme option to show panel header background. * Draw panel collapse widget a bit smaller. * Add theme option to draw icons muted. * Code tweak: replace U.themes.first by UI_GetTheme() calls. --- .../scripts/startup/bl_ui/space_userpref.py | 45 ++++++++++++- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/editors/include/UI_resources.h | 3 + .../editors/interface/interface_icons.c | 4 +- .../editors/interface/interface_intern.h | 2 +- .../editors/interface/interface_panel.c | 59 +++++++++++------ .../editors/interface/interface_style.c | 1 - .../editors/interface/interface_widgets.c | 6 +- source/blender/editors/interface/resources.c | 14 +++++ source/blender/editors/interface/view2d.c | 4 +- source/blender/editors/screen/area.c | 6 +- source/blender/editors/space_text/text_draw.c | 2 +- .../editors/space_view3d/drawarmature.c | 2 +- source/blender/makesdna/DNA_userdef_types.h | 17 +++-- source/blender/makesrna/intern/rna_userdef.c | 63 +++++++++---------- 15 files changed, 155 insertions(+), 75 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index c889e7f3de6..d71d57509c1 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -634,12 +634,51 @@ class USERPREF_PT_theme(Panel): colsub.row().prop(ui, "inner_key_sel") colsub.row().prop(ui, "blend") - ui = theme.user_interface col.separator() col.separator() - split = col.split(percentage=0.93) - split.prop(ui, "icon_file") + ui = theme.user_interface + col.label("Icons:") + + row = col.row() + + subsplit = row.split(percentage=0.95) + + padding = subsplit.split(percentage=0.15) + colsub = padding.column() + colsub = padding.column() + colsub.row().prop(ui, "icon_file") + + subsplit = row.split(percentage=0.85) + + padding = subsplit.split(percentage=0.15) + colsub = padding.column() + colsub = padding.column() + colsub.row().prop(ui, "icon_alpha") + + col.separator() + col.separator() + + ui = theme.user_interface.panel + col.label("Panels:") + + row = col.row() + + subsplit = row.split(percentage=0.95) + + padding = subsplit.split(percentage=0.15) + colsub = padding.column() + colsub = padding.column() + rowsub = colsub.row() + rowsub.prop(ui, "show_header") + rowsub.label() + + subsplit = row.split(percentage=0.85) + + padding = subsplit.split(percentage=0.15) + colsub = padding.column() + colsub = padding.column() + colsub.row().prop(ui, "header") layout.separator() layout.separator() diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 34b674fcb4a..fdd876ff29b 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 260 -#define BLENDER_SUBVERSION 4 +#define BLENDER_SUBVERSION 5 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 4b1371c532c..37a057303e9 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -318,6 +318,9 @@ void UI_ThemeClearColor(int colorid); // internal (blender) usage only, for init and set active void UI_SetTheme(int spacetype, int regionid); +// get current theme +struct bTheme *UI_GetTheme(void); + /* only for buttons in theme editor! */ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 089458f1da4..1b7308d328e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -506,7 +506,7 @@ static void init_brush_icons(void) static void init_internal_icons(void) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); ImBuf *bbuf= NULL; int x, y, icontype; char iconfilestr[FILE_MAXDIR+FILE_MAXFILE]; @@ -950,6 +950,7 @@ static int get_draw_size(enum eIconSizes size) static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) { + bTheme *btheme= UI_GetTheme(); Icon *icon = NULL; DrawInfo *di = NULL; IconImage *iimg; @@ -957,6 +958,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al int w, h; icon = BKE_icon_get(icon_id); + alpha *= btheme->tui.icon_alpha; if (icon==NULL) { if (G.f & G_DEBUG) diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 16e0153b910..d6460f9046e 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -112,7 +112,7 @@ typedef enum { /* internal panel drawing defines */ #define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */ -#define PNL_HEADER UI_UNIT_Y /* 20 default */ +#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */ /* panel->flag */ #define PNL_SELECT 1 diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index aa80cb632ec..ad79e550575 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -59,6 +59,7 @@ #include "ED_screen.h" #include "UI_interface.h" +#include "UI_resources.h" #include "interface_intern.h" @@ -173,7 +174,6 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar) Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open) { - uiStyle *style= UI_GetStyle(); Panel *pa, *patab, *palast, *panext; char *drawname= pt->label; char *idname= pt->idname; @@ -208,7 +208,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int } pa->ofsx= 0; - pa->ofsy= style->panelouter; + pa->ofsy= 0; pa->sizex= 0; pa->sizey= 0; pa->runtime_flag |= PNL_NEW_ADDED; @@ -482,6 +482,7 @@ static void rectf_scale(rctf *rect, float scale) /* panel integrated in buttonswindow, tool/property lists etc */ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) { + bTheme *btheme= UI_GetTheme(); Panel *panel= block->panel; rcti headrect; rctf itemrect; @@ -493,19 +494,37 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* calculate header rect */ /* + 0.001f to prevent flicker due to float inaccuracy */ headrect= *rect; - headrect.ymin= headrect.ymax; + headrect.ymin= headrect.ymax - 2.0f/block->aspect; headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f); - if(!(panel->runtime_flag & PNL_FIRST)) { - float minx= rect->xmin+5.0f/block->aspect; - float maxx= rect->xmax-5.0f/block->aspect; + { + float minx= rect->xmin; + float maxx= rect->xmax; float y= headrect.ymax; - + glEnable(GL_BLEND); - glColor4f(0.0f, 0.0f, 0.0f, 0.5f); - fdrawline(minx, y+1, maxx, y+1); - glColor4f(1.0f, 1.0f, 1.0f, 0.25f); - fdrawline(minx, y, maxx, y); + + if(btheme->tui.panel.show_header) { + /* draw with background color */ + glEnable(GL_BLEND); + glColor4ubv((unsigned char*)btheme->tui.panel.header); + glRectf(minx, headrect.ymin, maxx, y); + + fdrawline(minx, y, maxx, y); + fdrawline(minx, y, maxx, y); + } + else if(!(panel->runtime_flag & PNL_FIRST)) { + /* draw embossed separator */ + minx += 5.0f/block->aspect; + maxx -= 5.0f/block->aspect; + + glColor4f(0.0f, 0.0f, 0.0f, 0.5f); + fdrawline(minx, y+1, maxx, y+1); + glColor4f(1.0f, 1.0f, 1.0f, 0.25f); + fdrawline(minx, y, maxx, y); + glDisable(GL_BLEND); + } + glDisable(GL_BLEND); } @@ -518,7 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin); itemrect.ymin= headrect.ymin; itemrect.ymax= headrect.ymax; - rectf_scale(&itemrect, 0.8f); + + rectf_scale(&itemrect, 0.7f); ui_draw_panel_dragwidget(&itemrect); } @@ -538,7 +558,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* in some occasions, draw a border */ if(panel->flag & PNL_SELECT) { if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL); - else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); + else uiSetRoundBox(UI_CNR_NONE); UI_ThemeColorShade(TH_BACK, -120); uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8); @@ -567,7 +587,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) itemrect.ymin= headrect.ymin; itemrect.ymax= headrect.ymax; - rectf_scale(&itemrect, 0.5f); + rectf_scale(&itemrect, 0.35f); if(panel->flag & PNL_CLOSEDY) ui_draw_tria_rect(&itemrect, 'h'); @@ -589,12 +609,12 @@ static int get_panel_header(Panel *pa) return PNL_HEADER; } -static int get_panel_size_y(uiStyle *style, Panel *pa) +static int get_panel_size_y(Panel *pa) { if(pa->type && (pa->type->flag & PNL_NO_HEADER)) return pa->sizey; - return PNL_HEADER + pa->sizey + style->panelouter; + return PNL_HEADER + pa->sizey; } /* this function is needed because uiBlock and Panel itself dont @@ -667,7 +687,6 @@ static int compare_panel(const void *a1, const void *a2) /* returns 1 when it did something */ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) { - uiStyle *style= UI_GetStyle(); Panel *pa; PanelSort *ps, *panelsort, *psnext; int a, tot=0, done; @@ -719,18 +738,18 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) /* no smart other default start loc! this keeps switching f5/f6/etc compatible */ ps= panelsort; ps->pa->ofsx= 0; - ps->pa->ofsy= -get_panel_size_y(style, ps->pa); + ps->pa->ofsy= -get_panel_size_y(ps->pa); for(a=0; apa->ofsx= ps->pa->ofsx; - psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(style, psnext->pa); + psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa); } else { psnext->pa->ofsx= get_panel_real_ofsx(ps->pa); - psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(style, ps->pa) - get_panel_size_y(style, psnext->pa); + psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa); } } diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 0e9dbaf3022..3caafe308d0 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -124,7 +124,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id style->buttonspacex= 8; style->buttonspacey= 2; style->panelspace= 8; - style->panelouter= 4; return style; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c9fcb7f1d24..9a438070e1e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1617,7 +1617,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state) if(state & UI_SELECT) UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); else { - bTheme *btheme= U.themes.first; /* XXX */ + bTheme *btheme= UI_GetTheme(); /* XXX */ copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text); } @@ -2760,7 +2760,7 @@ static void widget_disabled(rcti *rect) static uiWidgetType *widget_type(uiWidgetTypeEnum type) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); static uiWidgetType wt; /* defaults */ @@ -2945,7 +2945,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) /* conversion from old to new buttons, so still messy */ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); ThemeUI *tui= &btheme->tui; uiFontStyle *fstyle= &style->widget; uiWidgetType *wt= NULL; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 738531e3bad..66add6d8f0c 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -839,6 +839,11 @@ void UI_SetTheme(int spacetype, int regionid) } } +bTheme *UI_GetTheme() +{ + return U.themes.first; +} + // for space windows only void UI_ThemeColor(int colorid) { @@ -1668,6 +1673,15 @@ void init_userdef_do_versions(void) } } + if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) { + bTheme *btheme; + + for(btheme= U.themes.first; btheme; btheme= btheme->next) { + SETCOL(btheme->tui.panel.header, 0, 0, 0, 25); + btheme->tui.icon_alpha= 1.0; + } + } + /* GL Texture Garbage Collection (variable abused above!) */ if (U.textimeout == 0) { U.texcollectrate = 60; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 5e97e01aed6..c2c482b0a2c 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1558,7 +1558,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if (scroll & V2D_SCROLL_HORIZONTAL) { /* only draw scrollbar when it doesn't fill the entire space */ if(vs->horfull==0) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); uiWidgetColors wcol= btheme->tui.wcol_scroll; rcti slider; int state; @@ -1669,7 +1669,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if (scroll & V2D_SCROLL_VERTICAL) { /* only draw scrollbar when it doesn't fill the entire space */ if(vs->vertfull==0) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); uiWidgetColors wcol= btheme->tui.wcol_scroll; rcti slider; int state; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 6a93e39a662..4c0faef760a 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1481,7 +1481,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * } x= 0; - y= -style->panelouter; + y= 0; /* create panels */ uiBeginPanels(C, ar); @@ -1553,11 +1553,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * if(pt->flag & PNL_NO_HEADER) y += yco; else - y += yco-style->panelouter; + y += yco; } else { x += w; - miny= MIN2(y, yco-style->panelouter-header); + miny= MIN2(y, yco-header); } } } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index d59d947f0c8..2465d42bbf1 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1179,7 +1179,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); uiWidgetColors wcol= btheme->tui.wcol_scroll; unsigned char col[4]; float rad; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index bbc72500df4..17cb1ce2995 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -115,7 +115,7 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan) * color set (based on the theme colors for 3d-view) is used. */ if (color_index > 0) { - bTheme *btheme= U.themes.first; + bTheme *btheme= UI_GetTheme(); bcolor= &btheme->tarm[(color_index - 1)]; } else if (color_index == -1) { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 0655b0b78b0..322e8a77565 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -112,9 +112,8 @@ typedef struct uiStyle { short buttonspacex; short buttonspacey; short panelspace; - short panelouter; - short pad[1]; + short pad[2]; } uiStyle; typedef struct uiWidgetColors { @@ -139,6 +138,12 @@ typedef struct uiWidgetStateColors { float blend, pad; } uiWidgetStateColors; +typedef struct uiPanelColors { + char header[4]; + short show_header; + short pad; +} uiPanelColors; + typedef struct ThemeUI { /* Interface Elements (buttons, menus, icons) */ @@ -149,9 +154,13 @@ typedef struct ThemeUI { uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item; uiWidgetStateColors wcol_state; - + + uiPanelColors panel; + char iconfile[80]; // FILE_MAXFILE length - + float icon_alpha; + + float pad; } ThemeUI; /* try to put them all in one, if needed a special struct can be created as well diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 329a8b70d85..34ee95c2962 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -506,6 +506,25 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } +static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ThemePanelColors", NULL); + RNA_def_struct_sdna(srna, "uiPanelColors"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors"); + + prop= RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_ui_text(prop, "Header", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Show Header", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +} + static void rna_def_userdef_theme_ui(BlenderRNA *brna) { StructRNA *srna; @@ -513,6 +532,7 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) rna_def_userdef_theme_ui_wcol(brna); rna_def_userdef_theme_ui_wcol_state(brna); + rna_def_userdef_theme_ui_panel(brna); srna= RNA_def_struct(brna, "ThemeUserInterface", NULL); RNA_def_struct_sdna(srna, "ThemeUI"); @@ -521,127 +541,102 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_regular"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Regular Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_tool"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Tool Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_radio"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Radio Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_text"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Text Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_option"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Option Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Toggle Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_num"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Number Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_numslider"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Slider Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_box"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Box Backdrop Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_pulldown"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Pulldown Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_back"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Backdrop Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_item"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Item Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Scroll Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_progress"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_list_item"); - RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "List Item Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "wcol_state"); - RNA_def_property_struct_type(prop, "ThemeWidgetStateColors"); RNA_def_property_ui_text(prop, "State Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "panel", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Panel Colors", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "iconfile"); RNA_def_property_ui_text(prop, "Icon File", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype) From e111353cade56824954fc6edf52a2eaa1606f8d2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 19 Nov 2011 22:05:18 +0000 Subject: [PATCH 180/203] UI: modify region expand widget from floating (+) icon into a dark tab with a light + in it. --- source/blender/editors/screen/area.c | 103 +++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4c0faef760a..4a06ee6d0ae 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -175,6 +175,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) dx= copysign(ceil(0.3f*fabs(dx)), dx); dy= copysign(ceil(0.3f*fabs(dy)), dy); + glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); glColor4ub(255, 255, 255, 180); @@ -192,6 +193,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1); glDisable(GL_LINE_SMOOTH); + glDisable(GL_BLEND); } static void region_draw_azone_icon(AZone *az) @@ -228,6 +230,49 @@ static void region_draw_azone_icon(AZone *az) sdrawline(midx-2, midy, midx+3, midy); } +static void draw_azone_plus(float x1, float y1, float x2, float y2) +{ + float width = 2.0f; + float pad = 4.0f; + + glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad); + glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f); + glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f); +} + +static void region_draw_azone_tab_plus(AZone *az) +{ + extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */ + + glEnable(GL_BLEND); + + /* add code to draw region hidden as 'too small' */ + switch(az->edge) { + case AE_TOP_TO_BOTTOMRIGHT: + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); + break; + case AE_BOTTOM_TO_TOPLEFT: + uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); + break; + case AE_LEFT_TO_TOPRIGHT: + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); + break; + case AE_RIGHT_TO_TOPLEFT: + uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT); + break; + } + + glColor4f(0.05f, 0.05f, 0.05f, 0.5f); + uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); + + glEnable(GL_BLEND); + + glColor4f(0.8f, 0.8f, 0.8f, 0.5f); + draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2); + + glDisable(GL_BLEND); +} + static void region_draw_azone_tab(AZone *az) { float col[3]; @@ -326,13 +371,14 @@ void ED_area_overdraw(bContext *C) if(az->ar) { /* only display tab or icons when the region is hidden */ if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { - - if(G.rt==2) + if(G.rt==3) + region_draw_azone_icon(az); + else if(G.rt==2) region_draw_azone_tria(az); else if(G.rt==1) region_draw_azone_tab(az); else - region_draw_azone_icon(az); + region_draw_azone_tab_plus(az); } } } @@ -665,6 +711,51 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar) } } +#define AZONEPAD_TAB_PLUSW 16 +#define AZONEPAD_TAB_PLUSH 16 + +/* region already made zero sized, in shape of edge */ +static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar) +{ + AZone *azt; + int tot= 0, add; + + for(azt= sa->actionzones.first; azt; azt= azt->next) { + if(azt->edge == az->edge) tot++; + } + + switch(az->edge) { + case AE_TOP_TO_BOTTOMRIGHT: + if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0; + az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW; + az->y1= ar->winrct.ymax - add; + az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW; + az->y2= ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH; + break; + case AE_BOTTOM_TO_TOPLEFT: + az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW; + az->y1= ar->winrct.ymin - AZONEPAD_TAB_PLUSH; + az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW; + az->y2= ar->winrct.ymin; + break; + case AE_LEFT_TO_TOPRIGHT: + az->x1= ar->winrct.xmin + 1 - AZONEPAD_TAB_PLUSH; + az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW; + az->x2= ar->winrct.xmin + 1; + az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW; + break; + case AE_RIGHT_TO_TOPLEFT: + az->x1= ar->winrct.xmax - 1; + az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW; + az->x2= ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH; + az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW; + break; + } + /* rect needed for mouse pointer test */ + BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); +} + + #define AZONEPAD_TABW 18 #define AZONEPAD_TABH 7 @@ -766,12 +857,14 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge) az->edge= edge; if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { - if(G.rt==2) + if(G.rt==3) + region_azone_icon(sa, az, ar); + else if(G.rt==2) region_azone_tria(sa, az, ar); else if(G.rt==1) region_azone_tab(sa, az, ar); else - region_azone_icon(sa, az, ar); + region_azone_tab_plus(sa, az, ar); } else { region_azone_edge(az, ar); } From 384ec1769b79d61fcf6c02cc9c6f696ca24d8101 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 19 Nov 2011 22:06:39 +0000 Subject: [PATCH 181/203] Cycles: another build system tweak that might solve build problem, not sure why this code is giving issues. --- intern/cycles/blender/CMakeLists.txt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index ea46911ce16..e81f02f2090 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -1,11 +1,4 @@ -set(BLENDER_INCLUDE_DIRS - ${CMAKE_SOURCE_DIR}/intern/guardedalloc - ${CMAKE_SOURCE_DIR}/source/blender/makesdna - ${CMAKE_SOURCE_DIR}/source/blender/makesrna - ${CMAKE_SOURCE_DIR}/source/blender/blenloader - ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern) - set(INC ../render ../device @@ -13,15 +6,18 @@ set(INC ../kernel/svm ../util ../subd + ../../../intern/guardedalloc + ../../../source/blender/makesdna + ../../../source/blender/makesrna + ../../../source/blender/blenloader + ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern ) set(INC_SYS - ${BLENDER_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ) - set(SRC blender_camera.cpp blender_mesh.cpp From 2b1f800e9e01194b30e8622b114e9e2f0d8414a6 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 19 Nov 2011 22:59:48 +0000 Subject: [PATCH 182/203] Bugfix for [#29279] Cycles Displacement Panel appears when blender render engine is choosen. --- intern/cycles/blender/addon/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 00010bb7463..f3ed3b677fb 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -295,7 +295,7 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball + return CyclesButtonsPanel.poll(context) and (context.mesh or context.curve or context.meta_ball) def draw(self, context): layout = self.layout From f515e430bc07bba280299c39abe6378942a204f6 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 19 Nov 2011 23:06:10 +0000 Subject: [PATCH 183/203] Bugfix for [#29327] background images: 'Not Set' displayed although image is already loaded. --- release/scripts/startup/bl_ui/space_view3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 15c04442142..6547fb7ad9f 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2297,7 +2297,7 @@ class VIEW3D_PT_background_image(Panel): row.prop(bg, "show_expanded", text="", emboss=False) if bg.source == 'IMAGE' and bg.image: row.prop(bg.image, "name", text="", emboss=False) - if bg.source == 'MOVIE' and bg.clip: + elif bg.source == 'MOVIE' and bg.clip: row.prop(bg.clip, "name", text="", emboss=False) else: row.label(text="Not Set") From 01b0cc7f2108fb1c33f8d95da41e18c5f3cead50 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 20 Nov 2011 00:32:39 +0000 Subject: [PATCH 184/203] UI/RNA: * Code cleanup. --- release/scripts/startup/bl_ui/properties_particle.py | 4 ---- release/scripts/startup/bl_ui/properties_scene.py | 7 +++---- release/scripts/startup/bl_ui/space_clip.py | 10 ++++------ release/scripts/startup/bl_ui/space_view3d.py | 10 +++------- source/blender/makesrna/intern/rna_scene.c | 2 +- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index a541f43be66..f7f67527b63 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -262,10 +262,6 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel): return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES) def draw_header(self, context): - #cloth = context.cloth.collision_settings - - #self.layout.active = cloth_panel_enabled(context.cloth) - #self.layout.prop(cloth, "use_collision", text="") psys = context.particle_system self.layout.prop(psys, "use_hair_dynamics", text="") diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 86880b9ddec..05f4887a542 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -195,14 +195,13 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER'} def draw_header(self, context): - scene = context.scene - rd = scene.render + rd = context.scene.render self.layout.prop(rd, "use_simplify", text="") def draw(self, context): layout = self.layout - scene = context.scene - rd = scene.render + + rd = context.scene.render layout.active = rd.use_simplify diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 237dd7f998d..a70d632e8b0 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -474,16 +474,14 @@ class CLIP_PT_stabilization(Panel): return sc.mode == 'RECONSTRUCTION' and sc.clip def draw_header(self, context): - sc = context.space_data - tracking = sc.clip.tracking - stab = tracking.stabilization - + stab = context.space_data.clip.tracking.stabilization + self.layout.prop(stab, "use_2d_stabilization", text="") def draw(self, context): layout = self.layout - sc = context.space_data - tracking = sc.clip.tracking + + tracking = context.space_data.clip.tracking stab = tracking.stabilization layout.active = stab.use_2d_stabilization diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6547fb7ad9f..295b7421017 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2192,10 +2192,9 @@ class VIEW3D_PT_view3d_motion_tracking(Panel): return (view) def draw_header(self, context): - layout = self.layout view = context.space_data - layout.prop(view, "show_reconstruction", text="") + self.layout.prop(view, "show_reconstruction", text="") def draw(self, context): layout = self.layout @@ -2277,10 +2276,9 @@ class VIEW3D_PT_background_image(Panel): bl_options = {'DEFAULT_CLOSED'} def draw_header(self, context): - layout = self.layout view = context.space_data - layout.prop(view, "show_background_images", text="") + self.layout.prop(view, "show_background_images", text="") def draw(self, context): layout = self.layout @@ -2359,14 +2357,12 @@ class VIEW3D_PT_transform_orientations(Panel): layout = self.layout view = context.space_data + orientation = view.current_orientation col = layout.column() - col.prop(view, "transform_orientation") col.operator("transform.create_orientation", text="Create") - orientation = view.current_orientation - if orientation: col.prop(orientation, "name") col.operator("transform.delete_orientation", text="Delete") diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e1fe34d5baf..50a58e43a80 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1123,8 +1123,8 @@ static void rna_def_transform_orientation(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); } From acf30220c9d63e0f060ee69115fe82016de025d4 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 20 Nov 2011 00:37:24 +0000 Subject: [PATCH 185/203] Replace "&" with "and" since on windows it separates the string and causes errors in the console. --- source/creator/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index fa68704c7cd..57551eab01a 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -311,7 +311,7 @@ if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*") # message after building. add_custom_command( TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' + COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}' ) endif() From e5f40a1aacfbdad8f802d6e80ea16c687d765daf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 Nov 2011 05:56:21 +0000 Subject: [PATCH 186/203] - pyapi mathutils.geometry.intersect_plane_plane - isect_plane_plane_v3 uses better method - minor refactor - arg name changes & some args as const. --- source/blender/blenkernel/intern/camera.c | 74 ++++---- source/blender/blenlib/BLI_math_geom.h | 32 ++-- source/blender/blenlib/intern/math_geom.c | 178 ++++++++++-------- .../python/mathutils/mathutils_geometry.c | 61 +++++- 4 files changed, 206 insertions(+), 139 deletions(-) diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index da7c0ab1774..08e8a80750e 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -456,7 +456,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data) unsigned int i; for (i= 0; i < 4; i++) { - float nd= -dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]); + float nd= dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]); if (nd < data->dist_vals[i]) { data->dist_vals[i]= nd; } @@ -530,55 +530,49 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]); } - if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_no, - plane_tx[0], data_cb.normal_tx[0], - plane_tx[2], data_cb.normal_tx[2]) == 0) || - (isect_plane_plane_v3(plane_isect_2, plane_isect_2_no, - plane_tx[1], data_cb.normal_tx[1], - plane_tx[3], data_cb.normal_tx[3]) == 0)) + isect_plane_plane_v3(plane_isect_1, plane_isect_1_no, + plane_tx[0], data_cb.normal_tx[0], + plane_tx[2], data_cb.normal_tx[2]); + isect_plane_plane_v3(plane_isect_2, plane_isect_2_no, + plane_tx[1], data_cb.normal_tx[1], + plane_tx[3], data_cb.normal_tx[3]); + + add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no); + add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no); + + if (isect_line_line_v3(plane_isect_1, plane_isect_1_other, + plane_isect_2, plane_isect_2_other, + plane_isect_pt_1, plane_isect_pt_2) == 0) { - /* this is very unlikely */ return FALSE; } else { + float cam_plane_no[3]= {0.0f, 0.0f, -1.0f}; + float plane_isect_delta[3]; + float plane_isect_delta_len; - add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no); - add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no); + mul_m3_v3(rot_obmat, cam_plane_no); - if (isect_line_line_v3(plane_isect_1, plane_isect_1_other, - plane_isect_2, plane_isect_2_other, - plane_isect_pt_1, plane_isect_pt_2) == 0) - { - return FALSE; + sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1); + plane_isect_delta_len= len_v3(plane_isect_delta); + + if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) { + copy_v3_v3(r_co, plane_isect_pt_1); + + /* offset shift */ + normalize_v3(plane_isect_1_no); + madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len); } else { - float cam_plane_no[3]= {0.0f, 0.0f, -1.0f}; - float plane_isect_delta[3]; - float plane_isect_delta_len; + copy_v3_v3(r_co, plane_isect_pt_2); - mul_m3_v3(rot_obmat, cam_plane_no); - - sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1); - plane_isect_delta_len= len_v3(plane_isect_delta); - - if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) { - copy_v3_v3(r_co, plane_isect_pt_1); - - /* offset shift */ - normalize_v3(plane_isect_1_no); - madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len); - } - else { - copy_v3_v3(r_co, plane_isect_pt_2); - - /* offset shift */ - normalize_v3(plane_isect_2_no); - madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len); - } - - - return TRUE; + /* offset shift */ + normalize_v3(plane_isect_2_no); + madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len); } + + + return TRUE; } } } diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 5c92d15c440..a2a4ffdc830 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -60,6 +60,7 @@ float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]); float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]); +float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]); float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); @@ -96,12 +97,13 @@ int isect_line_line_v3(const float v1[3], const float v2[3], float i1[3], float i2[3]); int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], - float vi[3], float *lambda); + float vi[3], float *r_lambda); /*if clip is nonzero, will only return true if lambda is >= 0.0 (i.e. intersection point is along positive d)*/ -int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], - float v1[3], float v2[3], float *lambda, int clip); +int isect_ray_plane_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, const int clip); /** * Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument. @@ -126,19 +128,19 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], * @param plane_b_co The point on the second plane. * @param plane_b_no The normal of the second plane. */ -int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], - const float plane_a_co[3], const float plane_a_no[3], - const float plane_b_co[3], const float plane_b_no[3]); +void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], + const float plane_a_co[3], const float plane_a_no[3], + const float plane_b_co[3], const float plane_b_no[3]); /* line/ray triangle */ int isect_line_tri_v3(const float p1[3], const float p2[3], - const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]); int isect_ray_tri_v3(const float p1[3], const float d[3], - const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]); int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], - const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float threshold); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold); int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], - const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon); /* point in polygon */ int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]); @@ -148,16 +150,16 @@ int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]); void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], - const float pt[2], float *uv); + const float pt[2], float r_uv[2]); void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], - const float v3[2], const float pt[2], float *uv); + const float v3[2], const float pt[2], float r_uv[2]); /* other */ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, - const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3]); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]); int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3], - const float v0[3], const float v1[3], const float v2[3], float *lambda); + const float v0[3], const float v1[3], const float v2[3], float *r_lambda); int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); @@ -184,7 +186,7 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3], void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); -void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); +void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); /***************************** View & Projection *****************************/ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 1170e44b27b..9d42ee347d4 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -238,6 +238,15 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float } /* signed distance from the point to the plane in 3D */ +float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]) +{ + float plane_co_other[3]; + + add_v3_v3v3(plane_co_other, plane_co, plane_no_unit); + + return line_point_factor_v3(p, plane_co, plane_co_other); +} + float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]) { float plane_no_unit[3]; @@ -246,7 +255,7 @@ float dist_to_plane_v3(const float p[3], const float plane_co[3], const float pl normalize_v3_v3(plane_no_unit, plane_no); add_v3_v3v3(plane_co_other, plane_co, plane_no_unit); - return -line_point_factor_v3(p, plane_co, plane_co_other); + return line_point_factor_v3(p, plane_co, plane_co_other); } /* distance v1 to line-piece v2-v3 in 3D */ @@ -601,7 +610,9 @@ int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2], test if the line starting at p1 ending at p2 intersects the triangle v0..v2 return non zero if it does */ -int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]) +int isect_line_tri_v3(const float p1[3], const float p2[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, float r_uv[2]) { float p[3], s[3], d[3], e1[3], e2[3], q[3]; @@ -626,12 +637,12 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c v = f * dot_v3v3(d, q); if ((v < 0.0f)||((u + v) > 1.0f)) return 0; - *lambda = f * dot_v3v3(e2, q); - if ((*lambda < 0.0f)||(*lambda > 1.0f)) return 0; + *r_lambda = f * dot_v3v3(e2, q); + if ((*r_lambda < 0.0f)||(*r_lambda > 1.0f)) return 0; - if(uv) { - uv[0]= u; - uv[1]= v; + if(r_uv) { + r_uv[0]= u; + r_uv[1]= v; } return 1; @@ -640,7 +651,9 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c test if the ray starting at p1 going in d direction intersects the triangle v0..v2 return non zero if it does */ -int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]) +int isect_ray_tri_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, float r_uv[2]) { float p[3], s[3], e1[3], e2[3], q[3]; float a, f, u, v; @@ -665,18 +678,20 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con v = f * dot_v3v3(d, q); if ((v < 0.0f)||((u + v) > 1.0f)) return 0; - *lambda = f * dot_v3v3(e2, q); - if ((*lambda < 0.0f)) return 0; + *r_lambda = f * dot_v3v3(e2, q); + if ((*r_lambda < 0.0f)) return 0; - if(uv) { - uv[0]= u; - uv[1]= v; + if(r_uv) { + r_uv[0]= u; + r_uv[1]= v; } return 1; } -int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, int clip) +int isect_ray_plane_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, const int clip) { float p[3], s[3], e1[3], e2[3], q[3]; float a, f; @@ -700,13 +715,15 @@ int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float /* v = f * dot_v3v3(d, q); */ /*UNUSED*/ - *lambda = f * dot_v3v3(e2, q); - if (clip && (*lambda < 0.0f)) return 0; + *r_lambda = f * dot_v3v3(e2, q); + if (clip && (*r_lambda < 0.0f)) return 0; return 1; } -int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon) +int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, float uv[2], const float epsilon) { float p[3], s[3], e1[3], e2[3], q[3]; float a, f, u, v; @@ -729,8 +746,8 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0 v = f * dot_v3v3(d, q); if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0; - *lambda = f * dot_v3v3(e2, q); - if ((*lambda < 0.0f)) return 0; + *r_lambda = f * dot_v3v3(e2, q); + if ((*r_lambda < 0.0f)) return 0; if(uv) { uv[0]= u; @@ -740,7 +757,9 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0 return 1; } -int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float *uv, const float threshold) +int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, float r_uv[2], const float threshold) { float p[3], s[3], e1[3], e2[3], q[3]; float a, f, u, v; @@ -757,8 +776,8 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float sub_v3_v3v3(s, p1, v0); cross_v3_v3v3(q, s, e1); - *lambda = f * dot_v3v3(e2, q); - if ((*lambda < 0.0f)) return 0; + *r_lambda = f * dot_v3v3(e2, q); + if ((*r_lambda < 0.0f)) return 0; u = f * dot_v3v3(s, p); v = f * dot_v3v3(d, q); @@ -782,9 +801,9 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float return 0; } - if(uv) { - uv[0]= u; - uv[1]= v; + if(r_uv) { + r_uv[0]= u; + r_uv[1]= v; } return 1; @@ -833,24 +852,16 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons } } -int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], +/* note: return normal isnt unit length */ +void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], const float plane_a_co[3], const float plane_a_no[3], const float plane_b_co[3], const float plane_b_no[3]) { - float p1_co_other[3], p2_co_other[3]; - float isect_co_dummy[3]; - - cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no); - cross_v3_v3v3(p1_co_other, plane_a_no, r_isect_no); - cross_v3_v3v3(p2_co_other, plane_b_no, r_isect_no); - - add_v3_v3(p1_co_other, plane_a_co); - add_v3_v3(p2_co_other, plane_b_co); - - /* we could use either ix_1, ix_2 - doesnt matter in this case */ - return isect_line_line_v3(plane_a_co, p1_co_other, - plane_b_co, p2_co_other, - r_isect_co, isect_co_dummy); + float plane_a_co_other[3]; + cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no); /* direction is simply the cross product */ + cross_v3_v3v3(plane_a_co_other, plane_a_no, r_isect_no); + add_v3_v3(plane_a_co_other, plane_a_co); + isect_line_plane_v3(r_isect_co, plane_a_co, plane_a_co_other, plane_b_co, plane_b_no, FALSE); } @@ -893,7 +904,10 @@ static int getLowestRoot(const float a, const float b, const float c, const floa return 0; } -int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3]) +int isect_sweeping_sphere_tri_v3( + const float p1[3], const float p2[3], const float radius, + const float v0[3], const float v1[3], const float v2[3], + float *r_lambda, float ipoint[3]) { float e1[3], e2[3], e3[3], point[3], vel[3], /*dist[3],*/ nor[3], temp[3], bv[3]; float a, b, c, d, e, x, y, z, radius2=radius*radius; @@ -960,14 +974,14 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo if(z <= 0.0f && (x >= 0.0f && y >= 0.0f)) { //(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000){ - *lambda=t0; + *r_lambda=t0; copy_v3_v3(ipoint,point); return 1; } } - *lambda=1.0f; + *r_lambda=1.0f; /*---test points---*/ a=dot_v3v3(vel,vel); @@ -977,7 +991,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *lambda, lambda)) + if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v0); found_by_sweep=1; @@ -988,7 +1002,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *lambda, lambda)) + if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v1); found_by_sweep=1; @@ -999,7 +1013,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *lambda, lambda)) + if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v2); found_by_sweep=1; @@ -1020,13 +1034,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *lambda, &newLambda)) + if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; if(e >= 0.0f && e <= 1.0f) { - *lambda = newLambda; + *r_lambda = newLambda; copy_v3_v3(ipoint,e1); mul_v3_fl(ipoint,e); add_v3_v3(ipoint, v0); @@ -1044,13 +1058,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *lambda, &newLambda)) + if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; if(e >= 0.0f && e <= 1.0f) { - *lambda = newLambda; + *r_lambda = newLambda; copy_v3_v3(ipoint,e2); mul_v3_fl(ipoint,e); add_v3_v3(ipoint, v0); @@ -1073,13 +1087,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *lambda, &newLambda)) + if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; if(e >= 0.0f && e <= 1.0f) { - *lambda = newLambda; + *r_lambda = newLambda; copy_v3_v3(ipoint,e3); mul_v3_fl(ipoint,e); add_v3_v3(ipoint, v1); @@ -1090,7 +1104,8 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo return found_by_sweep; } -int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda) +int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3], + const float v0[3], const float v1[3], const float v2[3], float *r_lambda) { float p[3], e1[3], e2[3]; float u, v, f; @@ -1127,9 +1142,9 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3] if ((u < 0.0f) || ((u + v) > 1.0f)) return 0; - *lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]); + *r_lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]); - if ((*lambda < 0.0f) || (*lambda > 1.0f)) return 0; + if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0; return 1; } @@ -1203,7 +1218,7 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], /* Intersection point strictly between the two lines * 0 when no intersection is found * */ -int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *lambda) +int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *r_lambda) { float a[3], b[3], c[3], ab[3], cb[3], ca[3], dir1[3], dir2[3]; float d; @@ -1237,12 +1252,9 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float { mul_v3_fl(a, f1); add_v3_v3v3(vi, v1, a); - - if (lambda != NULL) - { - *lambda = f1; - } - + + if (r_lambda) *r_lambda = f1; + return 1; /* intersection found */ } else @@ -1306,7 +1318,7 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2 } /* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */ -void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv) +void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2]) { float x0,y0, x1,y1, wtot, v2d[2], w1, w2; @@ -1331,7 +1343,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2 wtot = w1+w2; /*w1 = w1/wtot;*/ /*w2 = w2/wtot;*/ - uv[0] = w1/wtot; + r_uv[0] = w1/wtot; } else { /* lines are parallel, lambda_cp_line_ex is 3d grrr */ /*printf("\tparallel1\n");*/ @@ -1353,7 +1365,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2 v2d[1] = pt[1]-pt_on_line[1]; w2 = len_v2(v2d); wtot = w1+w2; - uv[0] = w1/wtot; + r_uv[0] = w1/wtot; } /* Same as above to calc the uv[1] value, alternate calculation */ @@ -1371,7 +1383,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2 v2d[1] = y1-v1[1]; w2 = len_v2(v2d); wtot = w1+w2; - uv[1] = w1/wtot; + r_uv[1] = w1/wtot; } else { /* lines are parallel, lambda_cp_line_ex is 3d grrr */ /*printf("\tparallel2\n");*/ @@ -1394,23 +1406,23 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2 v2d[1] = pt[1]-pt_on_line[1]; w2 = len_v2(v2d); wtot = w1+w2; - uv[1] = w1/wtot; + r_uv[1] = w1/wtot; } /* may need to flip UV's here */ } /* same as above but does tri's and quads, tri's are a bit of a hack */ -void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv) +void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2]) { if (isquad) { - isect_point_quad_uv_v2(v0, v1, v2, v3, pt, uv); + isect_point_quad_uv_v2(v0, v1, v2, v3, pt, r_uv); } else { /* not for quads, use for our abuse of LineIntersectsTriangleUV */ float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3], lambda; - p1_3d[0] = p2_3d[0] = uv[0]; - p1_3d[1] = p2_3d[1] = uv[1]; + p1_3d[0] = p2_3d[0] = r_uv[0]; + p1_3d[1] = p2_3d[1] = r_uv[1]; p1_3d[2] = 1.0f; p2_3d[2] = -1.0f; v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0; @@ -1427,7 +1439,7 @@ void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[ copy_v2_v2(v2_3d, v2); /* Doing this in 3D is not nice */ - isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv); + isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, r_uv); } } @@ -1993,7 +2005,7 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3 #define IS_ZERO(x) ((x>(-DBL_EPSILON) && x0 ? (-1.0) : 1.0; - uv[0]= (float)(( (a-b) + s * desc ) / denom); + r_uv[0]= (float)(( (a-b) + s * desc ) / denom); } /* find UV such that fST = (1-u)(1-v)*ST0 + u*(1-v)*ST1 + u*v*ST2 + (1-u)*v*ST3 */ { - const double denom_s= (1-uv[0])*(st0[0]-st3[0]) + uv[0]*(st1[0]-st2[0]); - const double denom_t= (1-uv[0])*(st0[1]-st3[1]) + uv[0]*(st1[1]-st2[1]); + const double denom_s= (1-r_uv[0])*(st0[0]-st3[0]) + r_uv[0]*(st1[0]-st2[0]); + const double denom_t= (1-r_uv[0])*(st0[1]-st3[1]) + r_uv[0]*(st1[1]-st2[1]); int i= 0; double denom= denom_s; if(fabs(denom_s)size, plane_a_no->size, plane_b_co->size, plane_b_no->size)) { + PyErr_SetString(PyExc_ValueError, + "geometry.intersect_plane_plane(...): " + " can't use 2D Vectors"); + return NULL; + } + + isect_plane_plane_v3(isect_co, isect_no, + plane_a_co->vec, plane_a_no->vec, + plane_b_co->vec, plane_b_no->vec); + + normalize_v3(isect_no); + + ret= PyTuple_New(2); + PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_co, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_no, 3, Py_NEW, NULL)); + return ret; +} PyDoc_STRVAR(M_Geometry_intersect_line_sphere_doc, ".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n" @@ -1211,7 +1270,7 @@ static PyMethodDef M_Geometry_methods[]= { {"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc}, {"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc}, {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc}, - /* TODO: isect_plane_plane_v3 --> intersect_plane_plane */ + {"intersect_plane_plane", (PyCFunction) M_Geometry_intersect_plane_plane, METH_VARARGS, M_Geometry_intersect_plane_plane_doc}, {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc}, From 6d5cf584468c0a9453c8888fa5bf96c7b9fcabd1 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Sun, 20 Nov 2011 10:52:25 +0000 Subject: [PATCH 187/203] Dynamic Paint: * Vertex color output now works even if there is a constructive modifier, like ocean sim, before dpaint. * Fixed a crash when canvas mesh had no vertices. * Fix: Smudge was also processed for incompatible surface types causing corrupted output. --- .../blender/blenkernel/intern/dynamicpaint.c | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 7634d694150..6cb021b51b7 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1475,11 +1475,12 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface) } /* make sure allocated surface size matches current requirements */ -static void dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface) +static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface) { if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) { - dynamicPaint_resetSurface(surface); + return dynamicPaint_resetSurface(surface); } + return 1; } @@ -1614,6 +1615,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData /* paint layer */ col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name); + /* if output layer is lost from a constructive modifier, re-add it */ + if (!col && dynamicPaint_outputLayerExists(surface, ob, 0)) + col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name); + /* apply color */ if (col) { #pragma omp parallel for schedule(static) for (i=0; ifaceData, CD_MCOL, surface->output_name2); + /* if output layer is lost from a constructive modifier, re-add it */ + if (!col && dynamicPaint_outputLayerExists(surface, ob, 1)) + col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name2); + /* apply color */ if (col) { #pragma omp parallel for schedule(static) for (i=0; iflags & MOD_DPAINT_ACTIVE)) continue; /* make sure surface is valid */ - dynamicPaint_checkSurfaceData(surface); + if (!dynamicPaint_checkSurfaceData(surface)) continue; /* limit frame range */ CLAMP(current_frame, surface->start_frame, surface->end_frame); @@ -3396,7 +3405,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, velocity_val = len_v3(velocity); /* if brush has smudge enabled store brush velocity */ - if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && + brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { copy_v3_v3(&bData->brush_velocity[index*4], velocity); mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val); bData->brush_velocity[index*4+3] = velocity_val; @@ -3690,7 +3700,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, velocity_val = len_v3(velocity); /* store brush velocity for smudge */ - if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && + brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { copy_v3_v3(&bData->brush_velocity[index*4], velocity); mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val); bData->brush_velocity[index*4+3] = velocity_val; @@ -3788,7 +3799,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po velocity_val = len_v3(velocity); /* store brush velocity for smudge */ - if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && + brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { copy_v3_v3(&bData->brush_velocity[index*4], velocity); mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val); bData->brush_velocity[index*4+3] = velocity_val; @@ -4802,7 +4814,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su BrushMaterials bMats = {0}; /* calculate brush speed vectors if required */ - if (brush->flags & MOD_DPAINT_DO_SMUDGE) { + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) { bData->brush_velocity = MEM_callocN(sData->total_points*sizeof(float)*4, "Dynamic Paint brush velocity"); /* init adjacency data if not already */ if (!sData->adj_data) @@ -4852,7 +4864,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* process special brush effects, like smudge */ if (bData->brush_velocity) { - if (brush->flags & MOD_DPAINT_DO_SMUDGE) + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) dynamicPaint_doSmudge(surface, brush, timescale); MEM_freeN(bData->brush_velocity); bData->brush_velocity = NULL; From dde84e32915d2f3c2cea85a2d9116c237e3c4b0d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 11:34:25 +0000 Subject: [PATCH 188/203] Fix #29322: 'Active Clip' not saving after appending. Address for active clip used to be updated in direct scene linking, should be in library linking. --- source/blender/blenloader/intern/readfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4a530be58db..b1ddb894e67 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4726,6 +4726,9 @@ static void lib_link_scene(FileData *fd, Main *main) /*Game Settings: Dome Warp Text*/ sce->gm.dome.warptext= newlibadr(fd, sce->id.lib, sce->gm.dome.warptext); + /* Motion Tracking */ + sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip); + sce->id.flag -= LIB_NEEDLINK; } @@ -4929,8 +4932,6 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->nodetree= newdataadr(fd, sce->nodetree); if(sce->nodetree) direct_link_nodetree(fd, sce->nodetree); - - sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip); } /* ************ READ WM ***************** */ From 57e75591b698bc9f51d3ac4482c07e7ad5e6553a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 11:44:32 +0000 Subject: [PATCH 189/203] Tweaks in convert tracking constraint to f-curves operator. --- release/scripts/startup/bl_operators/clip.py | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 6c2256dc08b..59c4f88251d 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -259,14 +259,10 @@ object's movement caused by this constraint""" con = x if not con: - return + self.report({'ERROR'}, + "Motion Tracking constraint to be converted not found") - if con.type == 'FOLLOW_TRACK' and con.use_3d_position: - mat = ob.matrix_world.copy() - ob.constraints.remove(con) - ob.matrix_world = mat - - return + return {'CANCELLED'} # Get clip used for parenting if con.use_active_clip: @@ -275,7 +271,17 @@ object's movement caused by this constraint""" clip = con.clip if not clip: - return + self.report({'ERROR'}, + "Movie clip to use tracking data from isn't set") + + return {'CANCELLED'} + + if con.type == 'FOLLOW_TRACK' and con.use_3d_position: + mat = ob.matrix_world.copy() + ob.constraints.remove(con) + ob.matrix_world = mat + + return {'FINISHED'} # Find start and end frames for track in clip.tracking.tracks: From 9000db36312cdc514f2ffd967148eef13ed2e67f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 20 Nov 2011 13:47:15 +0000 Subject: [PATCH 190/203] RNA: fix compile issue with zero size arrays with old gcc. --- source/blender/makesrna/intern/makesrna.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index c21685c9add..1fcc8072f9b 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1434,21 +1434,21 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property case PROP_BOOLEAN: { if(!prop->arraydimension) fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } @@ -1509,21 +1509,21 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe case PROP_BOOLEAN: { if(!prop->arraydimension) fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else + else if(prop->totarraylength) fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } From 17b113c784aa30cf7ea06f0970a4427620fef4dc Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Sun, 20 Nov 2011 14:16:41 +0000 Subject: [PATCH 191/203] Option to rename the vertex color data layer used by Ocean modifier for foam. The modifier outputs foam values to both textures and a (temporary) vertex data layer. This layer was unnamed before, which makes it impossible to access in shader nodes. Now the user can input a custom name in the modifier panel, then use that same name in a shader input node to access foam values. http://www.pasteall.org/pic/21120 --- .../scripts/startup/bl_ui/properties_data_modifier.py | 11 +++++++---- source/blender/makesdna/DNA_modifier_types.h | 1 + source/blender/makesrna/intern/rna_modifier.c | 5 +++++ source/blender/modifiers/intern/MOD_ocean.c | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index e685de416ed..52b5ed5f36e 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -455,11 +455,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.prop(md, "use_normals") + layout.prop(md, "use_foam") row = layout.row() - row.prop(md, "use_foam") - sub = row.row() - sub.active = md.use_foam - sub.prop(md, "foam_coverage", text="Coverage") + row.active = md.use_foam + col = row.column() + col.prop(md, "foam_coverage", text="Coverage") + col = row.column() + col.label("Foam Data Layer Name") + col.prop(md, "foam_layer_name", text="") layout.separator() diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index c009b9cc5fb..ed3d42a9da7 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -777,6 +777,7 @@ typedef struct OceanModifierData { int bakeend; char cachepath[240]; // FILE_MAX + char foamlayername[32]; char cached; char geometry_mode; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b95224e6703..6885000ce18 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2993,6 +2993,11 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); RNA_def_property_update(prop, 0, NULL); + prop= RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "foamlayername"); + RNA_def_property_ui_text(prop, "Foam Layer Name", "Name of the vertex color layer used for foam"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "chop_amount"); RNA_def_property_ui_text(prop, "Choppiness", ""); diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 55d121737c1..726c37811fb 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -147,6 +147,7 @@ static void initData(ModifierData *md) omd->bakeend = 250; omd->oceancache = NULL; omd->foam_fade = 0.98; + omd->foamlayername[0] = '\0'; /* layer name empty by default */ omd->ocean = BKE_add_ocean(); init_ocean_modifier(omd); @@ -441,7 +442,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), if(cdlayer >= MAX_MCOL) return dm; - CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces); + CustomData_add_layer_named(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces, omd->foamlayername); mc = dm->getFaceDataArray(dm, CD_MCOL); mv = dm->getVertArray(dm); From d4c400b940f862f28d7af5bd7e59ce7f14025735 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 20 Nov 2011 14:31:01 +0000 Subject: [PATCH 192/203] UI: fix issue with part of panels going offscreen after recent commit. The code here was tricky, with ED_region_panels trying to match the complex logic in uiAlignPanelStep, now refactored the code so it's avoided. --- source/blender/editors/include/UI_interface.h | 3 +- .../editors/interface/interface_panel.c | 39 ++++++++++++++++- source/blender/editors/screen/area.c | 42 ++++--------------- 3 files changed, 48 insertions(+), 36 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 01273b291a2..a0b477413e4 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -592,7 +592,8 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname); * not clear yet so we postpone that. */ void uiBeginPanels(const struct bContext *C, struct ARegion *ar); -void uiEndPanels(const struct bContext *C, struct ARegion *ar); +void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y); +void uiDrawPanels(const struct bContext *C, struct ARegion *ar); struct Panel *uiBeginPanel(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, struct PanelType *pt, int *open); void uiEndPanel(uiBlock *block, int width, int height); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ad79e550575..d66e6852f1d 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -779,6 +779,35 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) return done; } +static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y) +{ + Panel *pa; + int align= panel_aligned(sa, ar); + int sizex = UI_PANEL_WIDTH; + int sizey = UI_PANEL_WIDTH; + + /* compute size taken up by panels, for setting in view2d */ + for(pa= ar->panels.first; pa; pa= pa->next) { + if(pa->runtime_flag & PNL_ACTIVE) { + int pa_sizex, pa_sizey; + + if(align==BUT_VERTICAL) { + pa_sizex= pa->ofsx + pa->sizex; + pa_sizey= get_panel_real_ofsy(pa); + } + else { + pa_sizex= get_panel_real_ofsx(pa) + pa->sizex; + pa_sizey= pa->ofsy + get_panel_size_y(pa); + } + + sizex= MAX2(sizex, pa_sizex); + sizey= MIN2(sizey, pa_sizey); + } + } + + *x= sizex; + *y= sizey; +} static void ui_do_animate(const bContext *C, Panel *panel) { @@ -818,7 +847,7 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) } /* only draws blocks with panels */ -void uiEndPanels(const bContext *C, ARegion *ar) +void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y) { ScrArea *sa= CTX_wm_area(C); uiBlock *block; @@ -871,6 +900,14 @@ void uiEndPanels(const bContext *C, ARegion *ar) if(firstpa) firstpa->runtime_flag |= PNL_FIRST; + + /* compute size taken up by panel */ + ui_panels_size(sa, ar, x, y); +} + +void uiDrawPanels(const bContext *C, ARegion *ar) +{ + uiBlock *block; UI_ThemeClearColor(TH_BACK); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4a06ee6d0ae..f3d087d6986 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1559,7 +1559,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * Panel *panel; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; - int xco, yco, x, y, miny=0, w, em, header, triangle, open, newcontext= 0; + int x, y, xco, yco, w, em, triangle, open, newcontext= 0; if(contextnr >= 0) newcontext= UI_view2d_tab_set(v2d, contextnr); @@ -1573,9 +1573,6 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y; } - x= 0; - y= 0; - /* create panels */ uiBeginPanels(C, ar); @@ -1594,16 +1591,12 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * panel= uiBeginPanel(sa, ar, block, pt, &open); /* bad fixed values */ - header= (pt->flag & PNL_NO_HEADER)? 0: UI_UNIT_Y; triangle= (int)(UI_UNIT_Y * 1.1f); - if(vertical) - y -= header; - - if(pt->draw_header && header && (open || vertical)) { + if(pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) { /* for enabled buttons */ panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, - triangle, header+style->panelspace, header, 1, style); + triangle, UI_UNIT_Y+style->panelspace, UI_UNIT_Y, 1, style); pt->draw_header(C, panel); @@ -1641,30 +1634,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * } uiEndBlock(C, block); - - if(vertical) { - if(pt->flag & PNL_NO_HEADER) - y += yco; - else - y += yco; - } - else { - x += w; - miny= MIN2(y, yco-header); - } } } - if(vertical) - x += w; - else - y= miny; - - /* in case there are no panels */ - if(x == 0 || y == 0) { - x= UI_PANEL_WIDTH; - y= UI_PANEL_WIDTH; - } + /* align panels and return size */ + uiEndPanels(C, ar, &x, &y); /* clear */ UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW)?TH_PREVIEW_BACK:TH_BACK); @@ -1706,9 +1680,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * /* set the view */ UI_view2d_view_ortho(v2d); - /* this does the actual drawing! */ - uiEndPanels(C, ar); - + /* draw panels */ + uiDrawPanels(C, ar); + /* restore view matrix */ UI_view2d_view_restore(C); From be701c7336a3f967a3a2807f8a7a0c511cb76815 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 20 Nov 2011 14:36:23 +0000 Subject: [PATCH 193/203] * UI fix for recent Ocean Foam change, makes it a bit more compact. --- .../startup/bl_ui/properties_data_modifier.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 52b5ed5f36e..288f04b084e 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -454,14 +454,18 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.separator() layout.prop(md, "use_normals") - - layout.prop(md, "use_foam") - row = layout.row() - row.active = md.use_foam - col = row.column() - col.prop(md, "foam_coverage", text="Coverage") - col = row.column() - col.label("Foam Data Layer Name") + + split = layout.split() + + col = split.column() + col.prop(md, "use_foam") + sub = col.row() + sub.active = md.use_foam + sub.prop(md, "foam_coverage", text="Coverage") + + col = split.column() + col.active = md.use_foam + col.label("Foam Data Layer Name:") col.prop(md, "foam_layer_name", text="") layout.separator() From f1eb66aa68105ac27f371f4f708d8abf3b7da38b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 Nov 2011 14:38:11 +0000 Subject: [PATCH 194/203] share code for fluidsim, ocean & dynamic paint file paths. - use BLI_join_dirfile for joining all paths (no need to ensure slash is appended). - paths from linked library files now supported. --- source/blender/blenkernel/BKE_image.h | 2 +- source/blender/blenkernel/BKE_modifier.h | 3 + source/blender/blenkernel/BKE_ocean.h | 8 ++- .../blender/blenkernel/intern/dynamicpaint.c | 4 +- source/blender/blenkernel/intern/image.c | 4 +- source/blender/blenkernel/intern/modifier.c | 38 ++++++++++++ source/blender/blenkernel/intern/ocean.c | 25 ++++---- .../blenkernel/intern/particle_system.c | 7 ++- .../blender/editors/object/object_modifier.c | 7 ++- .../editors/physics/dynamicpaint_ops.c | 8 +-- .../blender/editors/physics/physics_fluid.c | 41 +++++++------ source/blender/editors/render/render_opengl.c | 6 +- source/blender/editors/screen/screendump.c | 4 +- source/blender/makesdna/DNA_object_fluidsim.h | 5 ++ source/blender/makesrna/intern/rna_fluidsim.c | 17 +++--- .../blender/makesrna/intern/rna_scene_api.c | 2 +- .../modifiers/intern/MOD_fluidsim_util.c | 61 ++++++------------- source/blender/modifiers/intern/MOD_ocean.c | 35 ++++------- .../nodes/node_composite_outputFile.c | 3 +- .../blender/render/intern/source/pipeline.c | 18 +++--- 20 files changed, 163 insertions(+), 135 deletions(-) diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index adb34f4c501..a3e0b5b6d5a 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -52,7 +52,7 @@ void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *re int BKE_alphatest_ibuf(struct ImBuf *ibuf); int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality); int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality); -void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames); +void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames); int BKE_add_image_extension(char *string, int imtype); int BKE_ftype_to_imtype(int ftype); int BKE_imtype_to_ftype(int imtype); diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index a47cefe6f65..84f8995b480 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -364,5 +364,8 @@ void test_object_modifiers(struct Object *ob); /* here for do_versions */ void modifier_mdef_compact_influences(struct ModifierData *md); +void modifier_path_init(char *path, int path_maxlen, const char *name); +const char *modifier_path_relbase(struct Object *ob); + #endif diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h index c1f228fe186..c8ce3f8ce63 100644 --- a/source/blender/blenkernel/BKE_ocean.h +++ b/source/blender/blenkernel/BKE_ocean.h @@ -48,7 +48,8 @@ typedef struct OceanCache { struct ImBuf **ibufs_foam; struct ImBuf **ibufs_norm; - char *bakepath; + const char *bakepath; + const char *relbase; /* precalculated for time range */ float *time; @@ -92,8 +93,9 @@ void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j) /* ocean cache handling */ -struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, - float chop_amount, float foam_coverage, float foam_fade, int resolution); +struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase, + int start, int end, float wave_scale, + float chop_amount, float foam_coverage, float foam_fade, int resolution); void BKE_simulate_ocean_cache(struct OceanCache *och, int frame); void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 6cb021b51b7..36ae764198a 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -976,8 +976,8 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett surface->wave_timescale = 1.0f; surface->wave_spring = 0.20f; - BLI_snprintf(surface->image_output_path, sizeof(surface->image_output_path), "%sdynamicpaint", U.textudir); - BLI_cleanup_dir(NULL, surface->image_output_path); + modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "dynamicpaint"); + dynamicPaintSurface_setUniqueName(surface, "Surface"); surface->effector_weights = BKE_add_effector_weights(NULL); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 08440849a4e..a61ae705020 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1484,11 +1484,11 @@ int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const } -void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames) +void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames) { if (string==NULL) return; BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */ - BLI_path_abs(string, G.main->name); + BLI_path_abs(string, relbase); if(use_frames) BLI_path_frame(string, frame, 4); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index bbc1b596889..f09be8c34ad 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -60,6 +60,11 @@ #include "BKE_key.h" #include "BKE_multires.h" +/* may move these, only for modifier_path_relbase */ +#include "BKE_global.h" /* ugh, G.main->name only */ +#include "BKE_main.h" +/* end */ + #include "MOD_modifiertypes.h" ModifierTypeInfo *modifierType_getInfo(ModifierType type) @@ -573,3 +578,36 @@ void test_object_modifiers(Object *ob) } } } + +/* where should this go?, it doesnt fit well anywhere :S - campbell */ + +/* elubie: changed this to default to the same dir as the render output + * to prevent saving to C:\ on Windows */ + +/* campbell: logic behind this... + * + * - if the ID is from a library, return library path + * - else if the file has been saved return the blend file path. + * - else if the file isn't saved and the ID isnt from a library, return the temp dir. + */ +const char *modifier_path_relbase(Object *ob) +{ + if (G.relbase_valid || ob->id.lib) { + return ID_BLEND_PATH(G.main, &ob->id); + } + else { + /* last resort, better then using "" which resolves to the current + * working directory */ + return BLI_temporary_dir(); + } +} + +/* initializes the path with either */ +void modifier_path_init(char *path, int path_maxlen, const char *name) +{ + /* elubie: changed this to default to the same dir as the render output + * to prevent saving to C:\ on Windows */ + BLI_join_dirfile(path, path_maxlen, + G.relbase_valid ? "//" : BLI_temporary_dir(), + name); +} diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index df4cd94cf38..5cf0b8c2348 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -998,7 +998,7 @@ void BKE_free_ocean(struct Ocean *oc) #define CACHE_TYPE_FOAM 2 #define CACHE_TYPE_NORMAL 3 -static void cache_filename(char *string, const char *path, int frame, int type) +static void cache_filename(char *string, const char *path, const char *relbase, int frame, int type) { char cachepath[FILE_MAX]; const char *fname; @@ -1018,7 +1018,7 @@ static void cache_filename(char *string, const char *path, int frame, int type) BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname); - BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE); + BKE_makepicstring(string, cachepath, relbase, frame, R_OPENEXR, 1, TRUE); } void BKE_free_ocean_cache(struct OceanCache *och) @@ -1119,12 +1119,15 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, in } } -struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, - float chop_amount, float foam_coverage, float foam_fade, int resolution) +struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase, + int start, int end, float wave_scale, + float chop_amount, float foam_coverage, float foam_fade, int resolution) { OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); och->bakepath = bakepath; + och->relbase = relbase; + och->start = start; och->end = end; och->duration = (end - start) + 1; @@ -1158,17 +1161,17 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame) if (och->ibufs_disp[f] != NULL ) return; - cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE); + cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE); och->ibufs_disp[f] = IMB_loadiffname(string, 0); //if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string); //else printf("loaded cache %s \n", string); - cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM); + cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM); och->ibufs_foam[f] = IMB_loadiffname(string, 0); //if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string); //else printf("loaded cache %s \n", string); - cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL); + cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL); och->ibufs_norm[f] = IMB_loadiffname(string, 0); //if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string); //else printf("loaded cache %s \n", string); @@ -1288,18 +1291,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v } /* write the images */ - cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE); + cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE); if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Displacement File Output to %s\n", string); if (o->_do_jacobian) { - cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM); + cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM); if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Foam File Output to %s\n", string); } if (o->_do_normals) { - cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL); + cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL); if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec printf("Cannot save Normal File Output to %s\n", string); } @@ -1409,7 +1412,7 @@ struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start return och; } -void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), int UNUSED(frame)) +void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), const char *UNUSED(relbase), int UNUSED(frame)) { } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 74fd8ff128b..a955643cbcc 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3935,9 +3935,10 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) // return; // ok, start loading - BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath); - - BLI_path_abs(filename, G.main->name); + BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME); + + BLI_path_abs(filename, modifier_path_relbase(sim->ob)); + BLI_path_frame(filename, curFrame, 0); // fixed #frame-no gzf = gzopen(filename, "rb"); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index af9e6592eb5..7b747769e49 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1526,9 +1526,10 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); return OPERATOR_FINISHED; } - - och = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, - omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); + + och = BKE_init_ocean_cache(omd->cachepath, modifier_path_relbase(ob), + omd->bakestart, omd->bakeend, omd->wave_scale, + omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); och->time = MEM_mallocN(och->duration*sizeof(float), "foam bake time"); diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index a12a9c8720b..6e25307b786 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -312,22 +312,22 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf */ { char filename[FILE_MAX]; - /* make sure output path has ending slash */ - BLI_add_slash(surface->image_output_path); /* primary output layer */ if (surface->flags & MOD_DPAINT_OUT1) { /* set filepath */ - BLI_snprintf(filename, sizeof(filename), "%s%s", surface->image_output_path, surface->output_name); + BLI_join_dirfile(filename, sizeof(filename), surface->image_output_path, surface->output_name); BLI_path_frame(filename, frame, 4); + /* save image */ dynamicPaint_outputSurfaceImage(surface, filename, 0); } /* secondary output */ if (surface->flags & MOD_DPAINT_OUT2 && surface->type == MOD_DPAINT_SURFACE_T_PAINT) { /* set filepath */ - BLI_snprintf(filename, sizeof(filename), "%s%s", surface->image_output_path, surface->output_name2); + BLI_join_dirfile(filename, sizeof(filename), surface->image_output_path, surface->output_name2); BLI_path_frame(filename, frame, 4); + /* save image */ dynamicPaint_outputSurfaceImage(surface, filename, 1); } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 6e88d477d9c..9dd4503414a 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -640,14 +640,17 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF char newSurfdataPath[FILE_MAXDIR+FILE_MAXFILE]; // modified output settings const char *suffixConfig = FLUID_SUFFIX_CONFIG; int outStringsChanged = 0; - - // prepare names... - strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); - strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.main->name); // fixed #frame-no - // .tmp: dont overwrite/delete original file - BLI_snprintf(targetFile, FILE_MAXDIR+FILE_MAXFILE, "%s%s.tmp", targetDir, suffixConfig); + // prepare names... + const char *relbase= modifier_path_relbase(fsDomain); + + BLI_strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); + BLI_strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); /* if 0'd out below, this value is never used! */ + BLI_path_abs(targetDir, relbase); // fixed #frame-no + + BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfig); + /* .tmp: dont overwrite/delete original file */ + strncat(targetFile, ".tmp", FILE_MAX); // make sure all directories exist // as the bobjs use the same dir, this only needs to be checked @@ -663,7 +666,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF BLI_delete(targetFile, 0,0); } - if((strlen(targetDir)<1) || (!dirExist)) { + if(targetDir[0] == '\0' || (!dirExist)) { char blendDir[FILE_MAXDIR+FILE_MAXFILE]; char blendFile[FILE_MAXDIR+FILE_MAXFILE]; @@ -805,20 +808,20 @@ static void fluidbake_free_data(FluidAnimChannels *channels, ListBase *fobjects, } /* copied from rna_fluidsim.c: fluidsim_find_lastframe() */ -static void fluidsim_delete_until_lastframe(FluidsimSettings *fss) +static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *relbase) { char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; char targetDirVel[FILE_MAXFILE+FILE_MAXDIR], targetFileVel[FILE_MAXFILE+FILE_MAXDIR]; char previewDir[FILE_MAXFILE+FILE_MAXDIR], previewFile[FILE_MAXFILE+FILE_MAXDIR]; int curFrame = 1, exists = 0; - BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath); - BLI_snprintf(targetDirVel, sizeof(targetDir), "%sfluidsurface_final_####.bvel.gz", fss->surfdataPath); - BLI_snprintf(previewDir, sizeof(targetDir), "%sfluidsurface_preview_####.bobj.gz", fss->surfdataPath); + BLI_join_dirfile(targetDir, sizeof(targetDir), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); + BLI_join_dirfile(targetDirVel, sizeof(targetDirVel), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_VEL_FNAME); + BLI_join_dirfile(previewDir, sizeof(previewDir), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME); - BLI_path_abs(targetDir, G.main->name); - BLI_path_abs(targetDirVel, G.main->name); - BLI_path_abs(previewDir, G.main->name); + BLI_path_abs(targetDir, relbase); + BLI_path_abs(targetDirVel, relbase); + BLI_path_abs(previewDir, relbase); do { BLI_strncpy(targetFile, targetDir, sizeof(targetFile)); @@ -851,6 +854,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor char debugStrBuffer[256]; int gridlevels = 0; + const char *relbase= modifier_path_relbase(fsDomain); const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp const char *suffixConfig = FLUID_SUFFIX_CONFIG; const char *suffixSurface = FLUID_SUFFIX_SURFACE; @@ -911,7 +915,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor domainSettings->lastgoodframe = -1; /* delete old baked files */ - fluidsim_delete_until_lastframe(domainSettings); + fluidsim_delete_until_lastframe(domainSettings, relbase); /* rough check of settings... */ if(domainSettings->previewresxyz > domainSettings->resolutionxyz) { @@ -997,7 +1001,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor /* ******** start writing / exporting ******** */ // use .tmp, dont overwrite/delete original file - BLI_snprintf(targetFile, 240, "%s%s.tmp", targetDir, suffixConfig); + BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfig); + strncat(targetFile, ".tmp", sizeof(targetFile)); // make sure these directories exist as well if(outStringsChanged) { @@ -1025,7 +1030,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor fsset->aniFrameTime = channels->aniFrameTime; fsset->noOfFrames = noFrames; // is otherwise subtracted in parser - BLI_snprintf(targetFile, 240, "%s%s", targetDir, suffixSurface); + BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixSurface); // defaults for compressibility and adaptive grids fsset->gstar = domainSettings->gstar; diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 843918e9173..188a61181ce 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -73,6 +73,7 @@ #include "render_intern.h" typedef struct OGLRender { + Main *bmain; Render *re; Scene *scene; @@ -223,7 +224,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) IMB_color_to_bw(ibuf); } - BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE); + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE); ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */ if(ok) printf("OpenGL Render written to '%s'\n", name); else printf("OpenGL Render failed to write '%s'\n", name); @@ -292,6 +293,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->ofs= ofs; oglrender->sizex= sizex; oglrender->sizey= sizey; + oglrender->bmain= CTX_data_main(C); oglrender->scene= scene; oglrender->write_still= is_write_still && !is_animation; @@ -462,7 +464,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } else { - BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); if(ok==0) { diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 017325c535e..8a90aadbee2 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -219,6 +219,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot) /* *************** screenshot movie job ************************* */ typedef struct ScreenshotJob { + Main *bmain; Scene *scene; unsigned int *dumprect; int x, y, dumpsx, dumpsy; @@ -297,7 +298,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float char name[FILE_MAXDIR+FILE_MAXFILE]; int ok; - BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE); ibuf->rect= sj->dumprect; ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality); @@ -355,6 +356,7 @@ static int screencast_exec(bContext *C, wmOperator *op) sj->dumpsx= curarea->totrct.xmax - sj->x; sj->dumpsy= curarea->totrct.ymax - sj->y; } + sj->bmain= CTX_data_main(C); sj->scene= CTX_data_scene(C); BKE_reports_init(&sj->reports, RPT_PRINT); diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index a32320b1740..fd6f4afd593 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -178,6 +178,11 @@ typedef struct FluidsimSettings { #define OB_FLUIDSIM_ACTIVE (1 << 1) #define OB_FLUIDSIM_OVERRIDE_TIME (1 << 2) +#define OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME "fluidsurface_preview_####.bobj.gz" +#define OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME "fluidsurface_final_####.bobj.gz" +#define OB_FLUIDSIM_SURF_FINAL_VEL_FNAME "fluidsurface_final_####.bvel.gz" +#define OB_FLUIDSIM_SURF_PARTICLES_FNAME "fluidsurface_particles_####.gz" + #ifdef __cplusplus } #endif diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index a7eedf5f062..09f339fa7db 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -83,18 +83,19 @@ static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } -static int fluidsim_find_lastframe(FluidsimSettings *fss) +static int fluidsim_find_lastframe(Object *ob, FluidsimSettings *fss) { - char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; + char targetFileTest[FILE_MAX]; + char targetFile[FILE_MAX]; int curFrame = 1; - BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath); - BLI_path_abs(targetDir, G.main->name); + BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); + BLI_path_abs(targetFile, modifier_path_relbase(ob)); do { - BLI_strncpy(targetFile, targetDir, sizeof(targetFile)); - BLI_path_frame(targetFile, curFrame++, 0); - } while(BLI_exists(targetFile)); + BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest)); + BLI_path_frame(targetFileTest, curFrame++, 0); + } while(BLI_exists(targetFileTest)); return curFrame - 1; } @@ -105,7 +106,7 @@ static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr) FluidsimModifierData *fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim); if(fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) { - fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(fluidmd->fss); + fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(ob, fluidmd->fss); } else { fluidmd->fss->lastgoodframe = -1; diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 250c61ed5f4..6816903090d 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -77,7 +77,7 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name if(BKE_imtype_is_movie(rd->imtype)) BKE_makeanimstring(name, rd); else - BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, rd->pic, G.main->name, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE); } #ifdef WITH_COLLADA diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 15e1cdfcb62..34c8c4cc1b1 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -69,8 +69,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) if(fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); - int surfdataPathMax = FILE_MAX; - + fluidmd->fss = fss; if(!fss) @@ -103,24 +102,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) // fluid/inflow settings // fss->iniVel --> automatically set to 0 - /* elubie: changed this to default to the same dir as the render output - to prevent saving to C:\ on Windows */ - if (G.relbase_valid) { /* is the .blend saved? */ - /* subfolder next to saved file */ - BLI_strncpy(fss->surfdataPath, "//fluid_cache", surfdataPathMax); - BLI_add_slash(fss->surfdataPath); - } - else { - /* subfolder in temp. directory */ - BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), surfdataPathMax); - surfdataPathMax -= strlen(fss->surfdataPath); - if (surfdataPathMax > 1) { - BLI_strncpy(fss->surfdataPath+strlen(fss->surfdataPath), "fluid_cache", surfdataPathMax); - surfdataPathMax -= strlen("fluid_cache"); - if (surfdataPathMax > 1) - BLI_add_slash(fss->surfdataPath); - } - } + modifier_path_init(fss->surfdataPath, sizeof(fss->surfdataPath), "fluid_cache"); // first init of bounding box // no bounding box needed @@ -461,11 +443,11 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * gzclose(gzf); } -static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int displaymode = 0; int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */ - char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; + char targetFile[FILE_MAXFILE+FILE_MAXDIR]; FluidsimSettings *fss = fluidmd->fss; DerivedMesh *dm = NULL; MFace *mface; @@ -478,27 +460,22 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData displaymode = fss->renderDisplayMode; } - BLI_strncpy(targetDir, fss->surfdataPath, sizeof(targetDir)); - - // use preview or final mesh? - if(displaymode==1) - { - // just display original object + switch (displaymode) { + case 1: + /* just display original object */ return NULL; - } - else if(displaymode==2) - { - strcat(targetDir,"fluidsurface_preview_####"); - } - else - { // 3 - strcat(targetDir,"fluidsurface_final_####"); + case 2: + /* use preview mesh */ + BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME); + break; + default: /* 3 */ + /* 3. use final mesh */ + BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); + break; } - BLI_path_abs(targetDir, G.main->name); - BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no - - BLI_snprintf(targetFile, sizeof(targetFile), "%s.bobj.gz", targetDir); + BLI_path_abs(targetFile, modifier_path_relbase(ob)); + BLI_path_frame(targetFile, curFrame, 0); // fixed #frame-no dm = fluidsim_read_obj(targetFile); @@ -554,7 +531,7 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData #endif // WITH_MOD_FLUID DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, - Object *UNUSED(ob), + Object *ob, DerivedMesh *dm, int useRenderParams, int UNUSED(isFinalCalc)) { @@ -587,7 +564,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ - if((result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams))) + if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) return result; return dm; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 726c37811fb..3ba49f26449 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -48,10 +48,13 @@ #include "MOD_util.h" #ifdef WITH_OCEANSIM -static void init_cache_data(struct OceanModifierData *omd) +static void init_cache_data(Object *ob, struct OceanModifierData *omd) { - omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale, - omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); + const char *relbase= modifier_path_relbase(ob); + + omd->oceancache = BKE_init_ocean_cache(omd->cachepath, relbase, + omd->bakestart, omd->bakeend, omd->wave_scale, + omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); } static void clear_cache_data(struct OceanModifierData *omd) @@ -97,7 +100,6 @@ static void initData(ModifierData *md) { #ifdef WITH_OCEANSIM OceanModifierData *omd = (OceanModifierData*) md; - int cachepathmax = sizeof(omd->cachepath); omd->resolution = 7; omd->spatial_size = 50; @@ -125,22 +127,7 @@ static void initData(ModifierData *md) omd->repeat_x = 1; omd->repeat_y = 1; - if (G.relbase_valid) { /* is the .blend saved? */ - /* subfolder next to saved file */ - BLI_strncpy(omd->cachepath, "//ocean_cache", cachepathmax); - BLI_add_slash(omd->cachepath); - } - else { - /* subfolder in temp. directory */ - BLI_strncpy(omd->cachepath, BLI_temporary_dir(), cachepathmax); - cachepathmax -= strlen(omd->cachepath); - if (cachepathmax > 1) { - BLI_strncpy(omd->cachepath+strlen(omd->cachepath), "ocean_cache", cachepathmax); - cachepathmax -= strlen("ocean_cache"); - if (cachepathmax > 1) - BLI_add_slash(omd->cachepath); - } - } + modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "ocean_cache"); omd->cached = 0; omd->bakestart = 1; @@ -377,9 +364,9 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) return result; } -static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), - DerivedMesh *derivedData, - int UNUSED(useRenderParams)) +static DerivedMesh *doOcean(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams)) { OceanModifierData *omd = (OceanModifierData*) md; @@ -410,7 +397,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), /* do ocean simulation */ if (omd->cached == TRUE) { - if (!omd->oceancache) init_cache_data(omd); + if (!omd->oceancache) init_cache_data(ob, omd); BKE_simulate_ocean_cache(omd->oceancache, md->scene->r.cfra); } else { simulate_ocean_modifier(omd); diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 5b502bbee7b..845c5b88020 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -56,6 +56,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * * scrubbing through the timeline when the compositor updates */ return; } else { + Main *bmain= G.main; /* TODO, have this passed along */ CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); char string[256]; @@ -74,7 +75,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * } } - BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE); + BKE_makepicstring(string, nif->name, bmain->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE); if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality)) printf("Cannot save Node File Output to %s\n", string); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index d7045c0b322..ca019e3ffe8 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -130,7 +130,7 @@ Render R; /* ********* alloc and free ******** */ -static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override); +static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const char *name_override); static volatile int g_break= 0; static int thread_break(void *UNUSED(arg)) @@ -2964,10 +2964,10 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr } else { char name[FILE_MAX]; - BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE); - + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE); + /* reports only used for Movie */ - do_write_image_or_movie(re, scene, NULL, name); + do_write_image_or_movie(re, bmain, scene, NULL, name); } } @@ -2978,7 +2978,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr G.rendering= 0; } -static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override) +static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const char *name_override) { char name[FILE_MAX]; RenderResult rres; @@ -3006,7 +3006,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, c if(name_override) BLI_strncpy(name, name_override, sizeof(name)); else - BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); if(re->r.imtype==R_MULTILAYER) { if(re->result) { @@ -3109,7 +3109,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri do_render_all_options(re); if(re->test_break(re->tbh) == 0) { - if(!do_write_image_or_movie(re, scene, mh, NULL)) + if(!do_write_image_or_movie(re, bmain, scene, mh, NULL)) G.afbreek= 1; } @@ -3151,7 +3151,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri /* Touch/NoOverwrite options are only valid for image's */ if(BKE_imtype_is_movie(scene->r.imtype) == 0) { if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH)) - BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); + BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) { printf("skipping existing frame \"%s\"\n", name); @@ -3173,7 +3173,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if(re->test_break(re->tbh) == 0) { if(!G.afbreek) - if(!do_write_image_or_movie(re, scene, mh, NULL)) + if(!do_write_image_or_movie(re, bmain, scene, mh, NULL)) G.afbreek= 1; } else From 778cd80eb8497c7c2e10385ea9274254ae9494cb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 20 Nov 2011 15:58:50 +0000 Subject: [PATCH 195/203] More UI messages fixes and tweaks (found while translating in french). --- source/blender/makesrna/intern/rna_fcurve.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index c651dca4b31..56f1efe3fed 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -637,7 +637,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FModifierGenerator", "FModifier"); - RNA_def_struct_ui_text(srna, "Generator F-Curve Modifier", "Deterministically generates values for the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Generator F-Modifier", "Deterministically generate values for the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Generator", "data"); /* define common props */ @@ -659,7 +659,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) // XXX this has a special validation func prop= RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Polynomial Order", - "The highest power of 'x' for this polynomial. (number of coefficients - 1)"); + "The highest power of 'x' for this polynomial (number of coefficients - 1)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); /* coefficients array */ @@ -689,7 +689,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier"); - RNA_def_struct_ui_text(srna, "Built-In Function F-Modifier", "Generates values using a Built-In Function"); + RNA_def_struct_ui_text(srna, "Built-In Function F-Modifier", "Generate values using a Built-In Function"); RNA_def_struct_sdna_from(srna, "FMod_FunctionGenerator", "data"); /* coefficients */ @@ -765,7 +765,7 @@ static void rna_def_fmodifier_envelope(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "FModifierEnvelope", "FModifier"); - RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scales the values of the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scale the values of the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Envelope", "data"); /* Collections */ @@ -802,13 +802,13 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"}, {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"}, {FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset", - "Repeat keyframe range, but with offset based on gradient between values"}, + "Repeat keyframe range, but with offset based on gradient between start and end values"}, {FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored", "Alternate between forward and reverse playback of keyframe range"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FModifierCycles", "FModifier"); - RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeats the values of the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeat the values of the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data"); /* before */ @@ -820,7 +820,7 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) prop= RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "before_cycles"); - RNA_def_property_ui_text(prop, "Before Cycles", "Maximum number of cycles to allow before first keyframe. (0 = infinite)"); + RNA_def_property_ui_text(prop, "Before Cycles", "Maximum number of cycles to allow before first keyframe (0 = infinite)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); /* after */ @@ -832,7 +832,7 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) prop= RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "after_cycles"); - RNA_def_property_ui_text(prop, "After Cycles", "Maximum number of cycles to allow after last keyframe. (0 = infinite)"); + RNA_def_property_ui_text(prop, "After Cycles", "Maximum number of cycles to allow after last keyframe (0 = infinite)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); } @@ -844,7 +844,7 @@ static void rna_def_fmodifier_python(BlenderRNA *brna) //PropertyRNA *prop; srna= RNA_def_struct(brna, "FModifierPython", "FModifier"); - RNA_def_struct_ui_text(srna, "Python F-Modifier", "Performs user-defined operation on the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Python F-Modifier", "Perform user-defined operation on the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Python", "data"); } @@ -856,7 +856,7 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "FModifierLimits", "FModifier"); - RNA_def_struct_ui_text(srna, "Limits F-Modifier", "Limits the time/value ranges of the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Limit F-Modifier", "Limit the time/value ranges of the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Limits", "data"); prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE); @@ -919,7 +919,7 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FModifierNoise", "FModifier"); - RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Gives randomness to the modified F-Curve"); + RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Give randomness to the modified F-Curve"); RNA_def_struct_sdna_from(srna, "FMod_Noise", "data"); prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); From af66321f3b7c1b84fada90fa0ab6f6e0774f4163 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 20 Nov 2011 16:08:56 +0000 Subject: [PATCH 196/203] == Sequencer / FFMPEG == This fixed two issues: * RAW DV-seeking has to be done using DTS. Sounds silly, but ffmpeg tracks internal state in RAW DV format decoder and runs mad, if we seek by byte. Don't know, why I haven't noticed that, when I added it. * real fix(tm) for #29295 problem was: we did AVFrame read ahead, and the pattern read_frame -> decode -> read_frame -> do color conversion of first frame works everywhere but RAW RGB-files which do some pointer shuffling within ffmpeg to save a memcpy... I removed read ahead completely, since it didn't work like originally intented. Might come back later, but the original purpose (making resyncing easier if we are completely lost in stream) it never fullfilled. --- source/blender/imbuf/intern/IMB_anim.h | 2 +- source/blender/imbuf/intern/anim_movie.c | 109 ++++++++++------------- 2 files changed, 46 insertions(+), 65 deletions(-) diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 5a410a6a583..b627baf99bd 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -173,6 +173,7 @@ struct anim { AVCodecContext *pCodecCtx; AVCodec *pCodec; AVFrame *pFrame; + int pFrameComplete; AVFrame *pFrameRGB; AVFrame *pFrameDeinterlaced; struct SwsContext *img_convert_ctx; @@ -181,7 +182,6 @@ struct anim { struct ImBuf * last_frame; int64_t last_pts; int64_t next_pts; - int64_t next_undecoded_pts; AVPacket next_packet; #endif diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index db27c1cee63..642b84f4897 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -504,7 +504,6 @@ static int startffmpeg(struct anim * anim) { anim->last_frame = 0; anim->last_pts = -1; anim->next_pts = -1; - anim->next_undecoded_pts = -1; anim->next_packet.stream_index = -1; anim->pFormatCtx = pFormatCtx; @@ -513,6 +512,7 @@ static int startffmpeg(struct anim * anim) { anim->videoStream = videoStream; anim->pFrame = avcodec_alloc_frame(); + anim->pFrameComplete = FALSE; anim->pFrameDeinterlaced = avcodec_alloc_frame(); anim->pFrameRGB = avcodec_alloc_frame(); @@ -602,6 +602,10 @@ static void ffmpeg_postprocess(struct anim * anim) ibuf->profile = IB_PROFILE_SRGB; + if (!anim->pFrameComplete) { + return; + } + /* This means the data wasnt read properly, this check stops crashing */ if (input->data[0]==0 && input->data[1]==0 @@ -611,6 +615,12 @@ static void ffmpeg_postprocess(struct anim * anim) return; } + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + " POSTPROC: anim->pFrame planes: %p %p %p %p\n", + input->data[0], input->data[1], input->data[2], + input->data[3]); + + if (anim->ib_flags & IB_animdeinterlace) { if (avpicture_deinterlace( (AVPicture*) @@ -715,42 +725,15 @@ static void ffmpeg_postprocess(struct anim * anim) } } -/* decode one video frame and load the next packet into anim->packet, - so that we can obtain next_pts and next undecoded pts */ +/* decode one video frame also considering the packet read into next_packet */ static int ffmpeg_decode_video_frame(struct anim * anim) { - int frameFinished = 0; int rval = 0; av_log(anim->pFormatCtx, AV_LOG_DEBUG, " DECODE VIDEO FRAME\n"); - anim->next_undecoded_pts = -1; - if (anim->next_packet.stream_index == anim->videoStream) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, - " DECODE: cached next packet\n"); - - avcodec_decode_video2(anim->pCodecCtx, - anim->pFrame, &frameFinished, - &anim->next_packet); - - if (frameFinished) { - av_log(anim->pFormatCtx, - AV_LOG_DEBUG, - " FRAME DONE: " - "next_pts=%lld pkt_pts=%lld\n", - (anim->pFrame->pts == AV_NOPTS_VALUE) ? - -1 : (long long int)anim->pFrame->pts, - (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? - -1 : (long long int)anim->pFrame->pkt_pts); - anim->next_pts = - av_get_pts_from_frame(anim->pFormatCtx, - anim->pFrame); - - ffmpeg_postprocess(anim); - } - av_free_packet(&anim->next_packet); anim->next_packet.stream_index = -1; } @@ -771,21 +754,14 @@ static int ffmpeg_decode_video_frame(struct anim * anim) (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); if (anim->next_packet.stream_index == anim->videoStream) { - if (frameFinished) { - av_log(anim->pFormatCtx, - AV_LOG_DEBUG, - " FRAME finished, we leave\n"); - anim->next_undecoded_pts - = anim->next_packet.dts; - break; - } + anim->pFrameComplete = 0; avcodec_decode_video2( anim->pCodecCtx, - anim->pFrame, &frameFinished, + anim->pFrame, &anim->pFrameComplete, &anim->next_packet); - if (frameFinished) { + if (anim->pFrameComplete) { anim->next_pts = av_get_pts_from_frame( anim->pFormatCtx, anim->pFrame); @@ -799,15 +775,16 @@ static int ffmpeg_decode_video_frame(struct anim * anim) == AV_NOPTS_VALUE) ? -1 : (long long int)anim->pFrame->pkt_pts, (long long int)anim->next_pts); - - ffmpeg_postprocess(anim); } + break; } av_free_packet(&anim->next_packet); anim->next_packet.stream_index = -1; } if (rval < 0) { + anim->next_packet.stream_index = -1; + av_log(anim->pFormatCtx, AV_LOG_ERROR, " DECODE READ FAILED: av_read_frame() " "returned error: %d\n", rval); @@ -875,7 +852,7 @@ static int match_format(const char *name, AVFormatContext * pFormatCtx) static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx) { - static const char * byte_seek_list [] = { "dv", "mpegts", 0 }; + static const char * byte_seek_list [] = { "mpegts", 0 }; const char ** p; if (pFormatCtx->iformat->flags & AVFMT_TS_DISCONT) { @@ -928,7 +905,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, tc_index, new_frame_index); } else { pts_to_search = (long long) - floor(((double) position) / pts_time_base / frame_rate + 0.5); + floor(((double) position) + / pts_time_base / frame_rate + 0.5); if (st_time != AV_NOPTS_VALUE) { pts_to_search += st_time / pts_time_base @@ -939,36 +917,23 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: looking for PTS=%lld " "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", - (long long int)pts_to_search, pts_time_base, frame_rate, st_time); + (long long int)pts_to_search,pts_time_base, frame_rate, st_time); if (anim->last_frame && anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){ av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: frame repeat: last: %lld next: %lld\n", - (long long int)anim->last_pts, (long long int)anim->next_pts); + (long long int)anim->last_pts, + (long long int)anim->next_pts); IMB_refImBuf(anim->last_frame); anim->curposition = position; return anim->last_frame; } - IMB_freeImBuf(anim->last_frame); - anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); - - if (anim->next_pts <= pts_to_search && - anim->next_undecoded_pts > pts_to_search) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, - "FETCH: no seek necessary: " - "next: %lld next undecoded: %lld\n", - (long long int)anim->next_pts, - (long long int)anim->next_undecoded_pts); - - /* we are already done :) */ - - } else if (position > anim->curposition + 1 - && anim->preseek - && !tc_index - && position - (anim->curposition + 1) < anim->preseek) { - + if (position > anim->curposition + 1 + && anim->preseek + && !tc_index + && position - (anim->curposition + 1) < anim->preseek) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: within preseek interval (no index)\n"); @@ -1017,6 +982,11 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, } else { pos = (long long) (position - anim->preseek) * AV_TIME_BASE / frame_rate; + + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "NO INDEX seek pos = %lld, st_time = %lld\n", + pos, (st_time != AV_NOPTS_VALUE) ? st_time : 0); + if (pos < 0) { pos = 0; } @@ -1025,6 +995,9 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, pos += st_time; } + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "NO INDEX final seek pos = %lld\n", pos); + ret = av_seek_frame(anim->pFormatCtx, -1, pos, AVSEEK_FLAG_BACKWARD); } @@ -1054,8 +1027,16 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, } else if (position == 0 && anim->curposition == -1) { /* first frame without seeking special case... */ ffmpeg_decode_video_frame(anim); + } else { + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: no seek necessary, just continue...\n"); } + IMB_freeImBuf(anim->last_frame); + anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); + + ffmpeg_postprocess(anim); + anim->last_pts = anim->next_pts; ffmpeg_decode_video_frame(anim); @@ -1063,7 +1044,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, anim->curposition = position; IMB_refImBuf(anim->last_frame); - + return anim->last_frame; } From ca7d391de8fddb7549c60bba63c8d4671fffb0d2 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 20 Nov 2011 16:13:27 +0000 Subject: [PATCH 197/203] Muting node patch: first part This allows node type init code to have access to the nodetree type object (needed to allow generic muting node initialization). Huge and boring edits... --- source/blender/blenkernel/BKE_node.h | 7 +- source/blender/blenkernel/intern/node.c | 349 +++++++++--------- source/blender/nodes/NOD_composite.h | 140 +++---- source/blender/nodes/NOD_shader.h | 114 +++--- source/blender/nodes/NOD_texture.h | 72 ++-- .../nodes/node_composite_alphaOver.c | 9 +- .../nodes/node_composite_bilateralblur.c | 7 +- .../composite/nodes/node_composite_blur.c | 9 +- .../nodes/node_composite_brightness.c | 7 +- .../nodes/node_composite_channelMatte.c | 6 +- .../nodes/node_composite_chromaMatte.c | 9 +- .../nodes/node_composite_colorMatte.c | 9 +- .../nodes/node_composite_colorSpill.c | 6 +- .../nodes/node_composite_colorbalance.c | 8 +- .../composite/nodes/node_composite_common.c | 18 +- .../nodes/node_composite_composite.c | 7 +- .../composite/nodes/node_composite_crop.c | 7 +- .../composite/nodes/node_composite_curves.c | 21 +- .../composite/nodes/node_composite_defocus.c | 9 +- .../nodes/node_composite_diffMatte.c | 9 +- .../composite/nodes/node_composite_dilate.c | 8 +- .../nodes/node_composite_directionalblur.c | 7 +- .../composite/nodes/node_composite_displace.c | 8 +- .../nodes/node_composite_distanceMatte.c | 9 +- .../composite/nodes/node_composite_filter.c | 9 +- .../composite/nodes/node_composite_flip.c | 9 +- .../composite/nodes/node_composite_gamma.c | 6 +- .../composite/nodes/node_composite_glare.c | 7 +- .../nodes/node_composite_hueSatVal.c | 9 +- .../nodes/node_composite_huecorrect.c | 8 +- .../composite/nodes/node_composite_idMask.c | 9 +- .../composite/nodes/node_composite_image.c | 15 +- .../composite/nodes/node_composite_invert.c | 7 +- .../composite/nodes/node_composite_lensdist.c | 7 +- .../composite/nodes/node_composite_levels.c | 8 +- .../nodes/node_composite_lummaMatte.c | 8 +- .../composite/nodes/node_composite_mapUV.c | 9 +- .../composite/nodes/node_composite_mapValue.c | 10 +- .../composite/nodes/node_composite_math.c | 10 +- .../composite/nodes/node_composite_mixrgb.c | 7 +- .../nodes/node_composite_movieclip.c | 6 +- .../nodes/node_composite_moviedistortion.c | 6 +- .../composite/nodes/node_composite_normal.c | 8 +- .../nodes/node_composite_normalize.c | 6 +- .../nodes/node_composite_outputFile.c | 9 +- .../nodes/node_composite_premulkey.c | 8 +- .../composite/nodes/node_composite_rgb.c | 9 +- .../composite/nodes/node_composite_rotate.c | 7 +- .../composite/nodes/node_composite_scale.c | 13 +- .../nodes/node_composite_sepcombHSVA.c | 15 +- .../nodes/node_composite_sepcombRGBA.c | 14 +- .../nodes/node_composite_sepcombYCCA.c | 15 +- .../nodes/node_composite_sepcombYUVA.c | 14 +- .../composite/nodes/node_composite_setalpha.c | 7 +- .../nodes/node_composite_splitViewer.c | 11 +- .../nodes/node_composite_stabilize2d.c | 6 +- .../composite/nodes/node_composite_texture.c | 9 +- .../composite/nodes/node_composite_tonemap.c | 7 +- .../nodes/node_composite_transform.c | 8 +- .../nodes/node_composite_translate.c | 8 +- .../composite/nodes/node_composite_valToRgb.c | 12 +- .../composite/nodes/node_composite_value.c | 8 +- .../composite/nodes/node_composite_vecBlur.c | 8 +- .../composite/nodes/node_composite_viewer.c | 6 +- .../composite/nodes/node_composite_zcombine.c | 7 +- source/blender/nodes/intern/node_common.c | 6 +- .../shader/nodes/node_shader_add_shader.c | 9 +- .../shader/nodes/node_shader_attribute.c | 7 +- .../shader/nodes/node_shader_background.c | 9 +- .../nodes/node_shader_bsdf_anisotropic.c | 9 +- .../shader/nodes/node_shader_bsdf_diffuse.c | 9 +- .../shader/nodes/node_shader_bsdf_glass.c | 9 +- .../shader/nodes/node_shader_bsdf_glossy.c | 9 +- .../nodes/node_shader_bsdf_translucent.c | 9 +- .../nodes/node_shader_bsdf_transparent.c | 9 +- .../shader/nodes/node_shader_bsdf_velvet.c | 9 +- .../nodes/shader/nodes/node_shader_camera.c | 8 +- .../nodes/shader/nodes/node_shader_common.c | 18 +- .../nodes/shader/nodes/node_shader_curves.c | 13 +- .../nodes/shader/nodes/node_shader_dynamic.c | 14 +- .../nodes/shader/nodes/node_shader_emission.c | 9 +- .../nodes/shader/nodes/node_shader_fresnel.c | 9 +- .../nodes/shader/nodes/node_shader_geom.c | 7 +- .../nodes/shader/nodes/node_shader_geometry.c | 9 +- .../nodes/shader/nodes/node_shader_holdout.c | 9 +- .../shader/nodes/node_shader_hueSatVal.c | 9 +- .../nodes/shader/nodes/node_shader_invert.c | 8 +- .../shader/nodes/node_shader_layer_weight.c | 9 +- .../shader/nodes/node_shader_light_path.c | 9 +- .../nodes/shader/nodes/node_shader_mapping.c | 6 +- .../nodes/shader/nodes/node_shader_material.c | 14 +- .../nodes/shader/nodes/node_shader_math.c | 8 +- .../nodes/shader/nodes/node_shader_mixRgb.c | 7 +- .../shader/nodes/node_shader_mix_shader.c | 9 +- .../nodes/shader/nodes/node_shader_normal.c | 6 +- .../nodes/shader/nodes/node_shader_output.c | 8 +- .../shader/nodes/node_shader_output_lamp.c | 9 +- .../nodes/node_shader_output_material.c | 9 +- .../shader/nodes/node_shader_output_world.c | 9 +- .../nodes/shader/nodes/node_shader_rgb.c | 7 +- .../shader/nodes/node_shader_sepcombRGB.c | 13 +- .../nodes/shader/nodes/node_shader_squeeze.c | 8 +- .../shader/nodes/node_shader_tex_coord.c | 9 +- .../nodes/node_shader_tex_environment.c | 9 +- .../shader/nodes/node_shader_tex_gradient.c | 9 +- .../shader/nodes/node_shader_tex_image.c | 9 +- .../shader/nodes/node_shader_tex_magic.c | 9 +- .../shader/nodes/node_shader_tex_musgrave.c | 9 +- .../shader/nodes/node_shader_tex_noise.c | 9 +- .../nodes/shader/nodes/node_shader_tex_sky.c | 9 +- .../shader/nodes/node_shader_tex_voronoi.c | 9 +- .../nodes/shader/nodes/node_shader_tex_wave.c | 7 +- .../nodes/shader/nodes/node_shader_texture.c | 8 +- .../nodes/shader/nodes/node_shader_valToRgb.c | 14 +- .../nodes/shader/nodes/node_shader_value.c | 8 +- .../nodes/shader/nodes/node_shader_vectMath.c | 8 +- .../nodes/node_shader_volume_isotropic.c | 9 +- .../nodes/node_shader_volume_transparent.c | 9 +- .../nodes/texture/nodes/node_texture_at.c | 6 +- .../nodes/texture/nodes/node_texture_bricks.c | 6 +- .../texture/nodes/node_texture_checker.c | 6 +- .../nodes/texture/nodes/node_texture_common.c | 18 +- .../texture/nodes/node_texture_compose.c | 6 +- .../nodes/texture/nodes/node_texture_coord.c | 6 +- .../nodes/texture/nodes/node_texture_curves.c | 13 +- .../texture/nodes/node_texture_decompose.c | 6 +- .../texture/nodes/node_texture_distance.c | 6 +- .../texture/nodes/node_texture_hueSatVal.c | 6 +- .../nodes/texture/nodes/node_texture_image.c | 6 +- .../nodes/texture/nodes/node_texture_invert.c | 7 +- .../nodes/texture/nodes/node_texture_math.c | 7 +- .../nodes/texture/nodes/node_texture_mixRgb.c | 6 +- .../nodes/texture/nodes/node_texture_output.c | 6 +- .../nodes/texture/nodes/node_texture_proc.c | 6 +- .../nodes/texture/nodes/node_texture_rotate.c | 6 +- .../nodes/texture/nodes/node_texture_scale.c | 6 +- .../texture/nodes/node_texture_texture.c | 6 +- .../texture/nodes/node_texture_translate.c | 6 +- .../texture/nodes/node_texture_valToNor.c | 6 +- .../texture/nodes/node_texture_valToRgb.c | 13 +- .../nodes/texture/nodes/node_texture_viewer.c | 6 +- 141 files changed, 843 insertions(+), 1025 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 580f78d3063..32e858bdcb6 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -325,7 +325,7 @@ struct bNode *nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp); void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node); void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node); -void nodeRegisterType(struct ListBase *typelist, struct bNodeType *ntype) ; +void nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype) ; void nodeMakeDynamicType(struct bNode *node); int nodeDynamicUnlinkText(struct ID *txtid); @@ -368,7 +368,8 @@ struct bNodeTree *nodeGroupEditSet(struct bNode *node, int edit); void nodeGroupEditClear(struct bNode *node); /* Init a new node type struct with default values and callbacks */ -void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void node_type_base(struct bNodeTreeType *ttype, struct bNodeType *ntype, int type, + const char *name, short nclass, short flag); void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs); void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth); void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp)); @@ -421,7 +422,7 @@ struct bNode *node_group_make_from_selected(struct bNodeTree *ntree); int node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode); /* in node_common.c */ -void register_node_type_frame(ListBase *lb); +void register_node_type_frame(struct bNodeTreeType *ttype); /* ************** SHADER NODES *************** */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index c4edddf587c..904e0d187f8 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1643,7 +1643,7 @@ struct bNodeTemplate nodeMakeTemplate(struct bNode *node) } } -void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char *name, short nclass, short flag) { memset(ntype, 0, sizeof(bNodeType)); @@ -1772,211 +1772,212 @@ static bNodeType *is_nodetype_registered(ListBase *typelist, int type) return NULL; } -void nodeRegisterType(ListBase *typelist, bNodeType *ntype) +void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype) { + ListBase *typelist = &(ttype->node_types); bNodeType *found= is_nodetype_registered(typelist, ntype->type); if(found==NULL) BLI_addtail(typelist, ntype); } -static void registerCompositNodes(ListBase *ntypelist) +static void registerCompositNodes(bNodeTreeType *ttype) { - register_node_type_frame(ntypelist); + register_node_type_frame(ttype); - register_node_type_cmp_group(ntypelist); -// register_node_type_cmp_forloop(ntypelist); -// register_node_type_cmp_whileloop(ntypelist); + register_node_type_cmp_group(ttype); +// register_node_type_cmp_forloop(ttype); +// register_node_type_cmp_whileloop(ttype); - register_node_type_cmp_rlayers(ntypelist); - register_node_type_cmp_image(ntypelist); - register_node_type_cmp_texture(ntypelist); - register_node_type_cmp_value(ntypelist); - register_node_type_cmp_rgb(ntypelist); - register_node_type_cmp_curve_time(ntypelist); - register_node_type_cmp_movieclip(ntypelist); + register_node_type_cmp_rlayers(ttype); + register_node_type_cmp_image(ttype); + register_node_type_cmp_texture(ttype); + register_node_type_cmp_value(ttype); + register_node_type_cmp_rgb(ttype); + register_node_type_cmp_curve_time(ttype); + register_node_type_cmp_movieclip(ttype); - register_node_type_cmp_composite(ntypelist); - register_node_type_cmp_viewer(ntypelist); - register_node_type_cmp_splitviewer(ntypelist); - register_node_type_cmp_output_file(ntypelist); - register_node_type_cmp_view_levels(ntypelist); + register_node_type_cmp_composite(ttype); + register_node_type_cmp_viewer(ttype); + register_node_type_cmp_splitviewer(ttype); + register_node_type_cmp_output_file(ttype); + register_node_type_cmp_view_levels(ttype); - register_node_type_cmp_curve_rgb(ntypelist); - register_node_type_cmp_mix_rgb(ntypelist); - register_node_type_cmp_hue_sat(ntypelist); - register_node_type_cmp_brightcontrast(ntypelist); - register_node_type_cmp_gamma(ntypelist); - register_node_type_cmp_invert(ntypelist); - register_node_type_cmp_alphaover(ntypelist); - register_node_type_cmp_zcombine(ntypelist); - register_node_type_cmp_colorbalance(ntypelist); - register_node_type_cmp_huecorrect(ntypelist); + register_node_type_cmp_curve_rgb(ttype); + register_node_type_cmp_mix_rgb(ttype); + register_node_type_cmp_hue_sat(ttype); + register_node_type_cmp_brightcontrast(ttype); + register_node_type_cmp_gamma(ttype); + register_node_type_cmp_invert(ttype); + register_node_type_cmp_alphaover(ttype); + register_node_type_cmp_zcombine(ttype); + register_node_type_cmp_colorbalance(ttype); + register_node_type_cmp_huecorrect(ttype); - register_node_type_cmp_normal(ntypelist); - register_node_type_cmp_curve_vec(ntypelist); - register_node_type_cmp_map_value(ntypelist); - register_node_type_cmp_normalize(ntypelist); + register_node_type_cmp_normal(ttype); + register_node_type_cmp_curve_vec(ttype); + register_node_type_cmp_map_value(ttype); + register_node_type_cmp_normalize(ttype); - register_node_type_cmp_filter(ntypelist); - register_node_type_cmp_blur(ntypelist); - register_node_type_cmp_dblur(ntypelist); - register_node_type_cmp_bilateralblur(ntypelist); - register_node_type_cmp_vecblur(ntypelist); - register_node_type_cmp_dilateerode(ntypelist); - register_node_type_cmp_defocus(ntypelist); + register_node_type_cmp_filter(ttype); + register_node_type_cmp_blur(ttype); + register_node_type_cmp_dblur(ttype); + register_node_type_cmp_bilateralblur(ttype); + register_node_type_cmp_vecblur(ttype); + register_node_type_cmp_dilateerode(ttype); + register_node_type_cmp_defocus(ttype); - register_node_type_cmp_valtorgb(ntypelist); - register_node_type_cmp_rgbtobw(ntypelist); - register_node_type_cmp_setalpha(ntypelist); - register_node_type_cmp_idmask(ntypelist); - register_node_type_cmp_math(ntypelist); - register_node_type_cmp_seprgba(ntypelist); - register_node_type_cmp_combrgba(ntypelist); - register_node_type_cmp_sephsva(ntypelist); - register_node_type_cmp_combhsva(ntypelist); - register_node_type_cmp_sepyuva(ntypelist); - register_node_type_cmp_combyuva(ntypelist); - register_node_type_cmp_sepycca(ntypelist); - register_node_type_cmp_combycca(ntypelist); - register_node_type_cmp_premulkey(ntypelist); + register_node_type_cmp_valtorgb(ttype); + register_node_type_cmp_rgbtobw(ttype); + register_node_type_cmp_setalpha(ttype); + register_node_type_cmp_idmask(ttype); + register_node_type_cmp_math(ttype); + register_node_type_cmp_seprgba(ttype); + register_node_type_cmp_combrgba(ttype); + register_node_type_cmp_sephsva(ttype); + register_node_type_cmp_combhsva(ttype); + register_node_type_cmp_sepyuva(ttype); + register_node_type_cmp_combyuva(ttype); + register_node_type_cmp_sepycca(ttype); + register_node_type_cmp_combycca(ttype); + register_node_type_cmp_premulkey(ttype); - register_node_type_cmp_diff_matte(ntypelist); - register_node_type_cmp_distance_matte(ntypelist); - register_node_type_cmp_chroma_matte(ntypelist); - register_node_type_cmp_color_matte(ntypelist); - register_node_type_cmp_channel_matte(ntypelist); - register_node_type_cmp_color_spill(ntypelist); - register_node_type_cmp_luma_matte(ntypelist); + register_node_type_cmp_diff_matte(ttype); + register_node_type_cmp_distance_matte(ttype); + register_node_type_cmp_chroma_matte(ttype); + register_node_type_cmp_color_matte(ttype); + register_node_type_cmp_channel_matte(ttype); + register_node_type_cmp_color_spill(ttype); + register_node_type_cmp_luma_matte(ttype); - register_node_type_cmp_translate(ntypelist); - register_node_type_cmp_rotate(ntypelist); - register_node_type_cmp_scale(ntypelist); - register_node_type_cmp_flip(ntypelist); - register_node_type_cmp_crop(ntypelist); - register_node_type_cmp_displace(ntypelist); - register_node_type_cmp_mapuv(ntypelist); - register_node_type_cmp_glare(ntypelist); - register_node_type_cmp_tonemap(ntypelist); - register_node_type_cmp_lensdist(ntypelist); - register_node_type_cmp_transform(ntypelist); - register_node_type_cmp_stabilize2d(ntypelist); - register_node_type_cmp_moviedistortion(ntypelist); + register_node_type_cmp_translate(ttype); + register_node_type_cmp_rotate(ttype); + register_node_type_cmp_scale(ttype); + register_node_type_cmp_flip(ttype); + register_node_type_cmp_crop(ttype); + register_node_type_cmp_displace(ttype); + register_node_type_cmp_mapuv(ttype); + register_node_type_cmp_glare(ttype); + register_node_type_cmp_tonemap(ttype); + register_node_type_cmp_lensdist(ttype); + register_node_type_cmp_transform(ttype); + register_node_type_cmp_stabilize2d(ttype); + register_node_type_cmp_moviedistortion(ttype); } -static void registerShaderNodes(ListBase *ntypelist) +static void registerShaderNodes(bNodeTreeType *ttype) { - register_node_type_frame(ntypelist); + register_node_type_frame(ttype); - register_node_type_sh_group(ntypelist); - //register_node_type_sh_forloop(ntypelist); - //register_node_type_sh_whileloop(ntypelist); + register_node_type_sh_group(ttype); + //register_node_type_sh_forloop(ttype); + //register_node_type_sh_whileloop(ttype); - register_node_type_sh_output(ntypelist); - register_node_type_sh_material(ntypelist); - register_node_type_sh_camera(ntypelist); - register_node_type_sh_value(ntypelist); - register_node_type_sh_rgb(ntypelist); - register_node_type_sh_mix_rgb(ntypelist); - register_node_type_sh_valtorgb(ntypelist); - register_node_type_sh_rgbtobw(ntypelist); - register_node_type_sh_texture(ntypelist); - register_node_type_sh_normal(ntypelist); - register_node_type_sh_geom(ntypelist); - register_node_type_sh_mapping(ntypelist); - register_node_type_sh_curve_vec(ntypelist); - register_node_type_sh_curve_rgb(ntypelist); - register_node_type_sh_math(ntypelist); - register_node_type_sh_vect_math(ntypelist); - register_node_type_sh_squeeze(ntypelist); - //register_node_type_sh_dynamic(ntypelist); - register_node_type_sh_material_ext(ntypelist); - register_node_type_sh_invert(ntypelist); - register_node_type_sh_seprgb(ntypelist); - register_node_type_sh_combrgb(ntypelist); - register_node_type_sh_hue_sat(ntypelist); + register_node_type_sh_output(ttype); + register_node_type_sh_material(ttype); + register_node_type_sh_camera(ttype); + register_node_type_sh_value(ttype); + register_node_type_sh_rgb(ttype); + register_node_type_sh_mix_rgb(ttype); + register_node_type_sh_valtorgb(ttype); + register_node_type_sh_rgbtobw(ttype); + register_node_type_sh_texture(ttype); + register_node_type_sh_normal(ttype); + register_node_type_sh_geom(ttype); + register_node_type_sh_mapping(ttype); + register_node_type_sh_curve_vec(ttype); + register_node_type_sh_curve_rgb(ttype); + register_node_type_sh_math(ttype); + register_node_type_sh_vect_math(ttype); + register_node_type_sh_squeeze(ttype); + //register_node_type_sh_dynamic(ttype); + register_node_type_sh_material_ext(ttype); + register_node_type_sh_invert(ttype); + register_node_type_sh_seprgb(ttype); + register_node_type_sh_combrgb(ttype); + register_node_type_sh_hue_sat(ttype); - register_node_type_sh_attribute(ntypelist); - register_node_type_sh_geometry(ntypelist); - register_node_type_sh_light_path(ntypelist); - register_node_type_sh_fresnel(ntypelist); - register_node_type_sh_layer_weight(ntypelist); - register_node_type_sh_tex_coord(ntypelist); + register_node_type_sh_attribute(ttype); + register_node_type_sh_geometry(ttype); + register_node_type_sh_light_path(ttype); + register_node_type_sh_fresnel(ttype); + register_node_type_sh_layer_weight(ttype); + register_node_type_sh_tex_coord(ttype); - register_node_type_sh_background(ntypelist); - register_node_type_sh_bsdf_diffuse(ntypelist); - register_node_type_sh_bsdf_glossy(ntypelist); - register_node_type_sh_bsdf_glass(ntypelist); - register_node_type_sh_bsdf_translucent(ntypelist); - register_node_type_sh_bsdf_transparent(ntypelist); - register_node_type_sh_bsdf_velvet(ntypelist); - register_node_type_sh_emission(ntypelist); - register_node_type_sh_holdout(ntypelist); - //register_node_type_sh_volume_transparent(ntypelist); - //register_node_type_sh_volume_isotropic(ntypelist); - register_node_type_sh_mix_shader(ntypelist); - register_node_type_sh_add_shader(ntypelist); + register_node_type_sh_background(ttype); + register_node_type_sh_bsdf_diffuse(ttype); + register_node_type_sh_bsdf_glossy(ttype); + register_node_type_sh_bsdf_glass(ttype); + register_node_type_sh_bsdf_translucent(ttype); + register_node_type_sh_bsdf_transparent(ttype); + register_node_type_sh_bsdf_velvet(ttype); + register_node_type_sh_emission(ttype); + register_node_type_sh_holdout(ttype); + //register_node_type_sh_volume_transparent(ttype); + //register_node_type_sh_volume_isotropic(ttype); + register_node_type_sh_mix_shader(ttype); + register_node_type_sh_add_shader(ttype); - register_node_type_sh_output_lamp(ntypelist); - register_node_type_sh_output_material(ntypelist); - register_node_type_sh_output_world(ntypelist); + register_node_type_sh_output_lamp(ttype); + register_node_type_sh_output_material(ttype); + register_node_type_sh_output_world(ttype); - register_node_type_sh_tex_image(ntypelist); - register_node_type_sh_tex_environment(ntypelist); - register_node_type_sh_tex_sky(ntypelist); - register_node_type_sh_tex_noise(ntypelist); - register_node_type_sh_tex_wave(ntypelist); - register_node_type_sh_tex_voronoi(ntypelist); - register_node_type_sh_tex_musgrave(ntypelist); - register_node_type_sh_tex_gradient(ntypelist); - register_node_type_sh_tex_magic(ntypelist); + register_node_type_sh_tex_image(ttype); + register_node_type_sh_tex_environment(ttype); + register_node_type_sh_tex_sky(ttype); + register_node_type_sh_tex_noise(ttype); + register_node_type_sh_tex_wave(ttype); + register_node_type_sh_tex_voronoi(ttype); + register_node_type_sh_tex_musgrave(ttype); + register_node_type_sh_tex_gradient(ttype); + register_node_type_sh_tex_magic(ttype); } -static void registerTextureNodes(ListBase *ntypelist) +static void registerTextureNodes(bNodeTreeType *ttype) { - register_node_type_frame(ntypelist); + register_node_type_frame(ttype); - register_node_type_tex_group(ntypelist); -// register_node_type_tex_forloop(ntypelist); -// register_node_type_tex_whileloop(ntypelist); + register_node_type_tex_group(ttype); +// register_node_type_tex_forloop(ttype); +// register_node_type_tex_whileloop(ttype); - register_node_type_tex_math(ntypelist); - register_node_type_tex_mix_rgb(ntypelist); - register_node_type_tex_valtorgb(ntypelist); - register_node_type_tex_rgbtobw(ntypelist); - register_node_type_tex_valtonor(ntypelist); - register_node_type_tex_curve_rgb(ntypelist); - register_node_type_tex_curve_time(ntypelist); - register_node_type_tex_invert(ntypelist); - register_node_type_tex_hue_sat(ntypelist); - register_node_type_tex_coord(ntypelist); - register_node_type_tex_distance(ntypelist); - register_node_type_tex_compose(ntypelist); - register_node_type_tex_decompose(ntypelist); + register_node_type_tex_math(ttype); + register_node_type_tex_mix_rgb(ttype); + register_node_type_tex_valtorgb(ttype); + register_node_type_tex_rgbtobw(ttype); + register_node_type_tex_valtonor(ttype); + register_node_type_tex_curve_rgb(ttype); + register_node_type_tex_curve_time(ttype); + register_node_type_tex_invert(ttype); + register_node_type_tex_hue_sat(ttype); + register_node_type_tex_coord(ttype); + register_node_type_tex_distance(ttype); + register_node_type_tex_compose(ttype); + register_node_type_tex_decompose(ttype); - register_node_type_tex_output(ntypelist); - register_node_type_tex_viewer(ntypelist); + register_node_type_tex_output(ttype); + register_node_type_tex_viewer(ttype); - register_node_type_tex_checker(ntypelist); - register_node_type_tex_texture(ntypelist); - register_node_type_tex_bricks(ntypelist); - register_node_type_tex_image(ntypelist); + register_node_type_tex_checker(ttype); + register_node_type_tex_texture(ttype); + register_node_type_tex_bricks(ttype); + register_node_type_tex_image(ttype); - register_node_type_tex_rotate(ntypelist); - register_node_type_tex_translate(ntypelist); - register_node_type_tex_scale(ntypelist); - register_node_type_tex_at(ntypelist); + register_node_type_tex_rotate(ttype); + register_node_type_tex_translate(ttype); + register_node_type_tex_scale(ttype); + register_node_type_tex_at(ttype); - register_node_type_tex_proc_voronoi(ntypelist); - register_node_type_tex_proc_blend(ntypelist); - register_node_type_tex_proc_magic(ntypelist); - register_node_type_tex_proc_marble(ntypelist); - register_node_type_tex_proc_clouds(ntypelist); - register_node_type_tex_proc_wood(ntypelist); - register_node_type_tex_proc_musgrave(ntypelist); - register_node_type_tex_proc_noise(ntypelist); - register_node_type_tex_proc_stucci(ntypelist); - register_node_type_tex_proc_distnoise(ntypelist); + register_node_type_tex_proc_voronoi(ttype); + register_node_type_tex_proc_blend(ttype); + register_node_type_tex_proc_magic(ttype); + register_node_type_tex_proc_marble(ttype); + register_node_type_tex_proc_clouds(ttype); + register_node_type_tex_proc_wood(ttype); + register_node_type_tex_proc_musgrave(ttype); + register_node_type_tex_proc_noise(ttype); + register_node_type_tex_proc_stucci(ttype); + register_node_type_tex_proc_distnoise(ttype); } static void free_dynamic_typeinfo(bNodeType *ntype) @@ -2010,9 +2011,9 @@ static void free_typeinfos(ListBase *list) void init_nodesystem(void) { - registerCompositNodes(&ntreeGetType(NTREE_COMPOSIT)->node_types); - registerShaderNodes(&ntreeGetType(NTREE_SHADER)->node_types); - registerTextureNodes(&ntreeGetType(NTREE_TEXTURE)->node_types); + registerCompositNodes(ntreeGetType(NTREE_COMPOSIT)); + registerShaderNodes(ntreeGetType(NTREE_SHADER)); + registerTextureNodes(ntreeGetType(NTREE_TEXTURE)); } void free_nodesystem(void) diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index 6deea004417..b74342ab516 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -42,84 +42,84 @@ extern bNodeTreeType ntreeType_Composite; /* ****************** types array for all composite nodes ****************** */ -void register_node_type_cmp_group(ListBase *lb); -void register_node_type_cmp_forloop(ListBase *lb); -void register_node_type_cmp_whileloop(ListBase *lb); +void register_node_type_cmp_group(struct bNodeTreeType *ttype); +void register_node_type_cmp_forloop(struct bNodeTreeType *ttype); +void register_node_type_cmp_whileloop(struct bNodeTreeType *ttype); -void register_node_type_cmp_rlayers(ListBase *lb); -void register_node_type_cmp_image(ListBase *lb); -void register_node_type_cmp_texture(ListBase *lb); -void register_node_type_cmp_value(ListBase *lb); -void register_node_type_cmp_rgb(ListBase *lb); -void register_node_type_cmp_curve_time(ListBase *lb); -void register_node_type_cmp_movieclip(ListBase *lb); +void register_node_type_cmp_rlayers(struct bNodeTreeType *ttype); +void register_node_type_cmp_image(struct bNodeTreeType *ttype); +void register_node_type_cmp_texture(struct bNodeTreeType *ttype); +void register_node_type_cmp_value(struct bNodeTreeType *ttype); +void register_node_type_cmp_rgb(struct bNodeTreeType *ttype); +void register_node_type_cmp_curve_time(struct bNodeTreeType *ttype); +void register_node_type_cmp_movieclip(struct bNodeTreeType *ttype); -void register_node_type_cmp_composite(ListBase *lb); -void register_node_type_cmp_viewer(ListBase *lb); -void register_node_type_cmp_splitviewer(ListBase *lb); -void register_node_type_cmp_output_file(ListBase *lb); -void register_node_type_cmp_view_levels(ListBase *lb); +void register_node_type_cmp_composite(struct bNodeTreeType *ttype); +void register_node_type_cmp_viewer(struct bNodeTreeType *ttype); +void register_node_type_cmp_splitviewer(struct bNodeTreeType *ttype); +void register_node_type_cmp_output_file(struct bNodeTreeType *ttype); +void register_node_type_cmp_view_levels(struct bNodeTreeType *ttype); -void register_node_type_cmp_curve_rgb(ListBase *lb); -void register_node_type_cmp_mix_rgb(ListBase *lb); -void register_node_type_cmp_hue_sat(ListBase *lb); -void register_node_type_cmp_brightcontrast(ListBase *lb); -void register_node_type_cmp_gamma(ListBase *lb); -void register_node_type_cmp_invert(ListBase *lb); -void register_node_type_cmp_alphaover(ListBase *lb); -void register_node_type_cmp_zcombine(ListBase *lb); -void register_node_type_cmp_colorbalance(ListBase *lb); -void register_node_type_cmp_huecorrect(ListBase *lb); +void register_node_type_cmp_curve_rgb(struct bNodeTreeType *ttype); +void register_node_type_cmp_mix_rgb(struct bNodeTreeType *ttype); +void register_node_type_cmp_hue_sat(struct bNodeTreeType *ttype); +void register_node_type_cmp_brightcontrast(struct bNodeTreeType *ttype); +void register_node_type_cmp_gamma(struct bNodeTreeType *ttype); +void register_node_type_cmp_invert(struct bNodeTreeType *ttype); +void register_node_type_cmp_alphaover(struct bNodeTreeType *ttype); +void register_node_type_cmp_zcombine(struct bNodeTreeType *ttype); +void register_node_type_cmp_colorbalance(struct bNodeTreeType *ttype); +void register_node_type_cmp_huecorrect(struct bNodeTreeType *ttype); -void register_node_type_cmp_normal(ListBase *lb); -void register_node_type_cmp_curve_vec(ListBase *lb); -void register_node_type_cmp_map_value(ListBase *lb); -void register_node_type_cmp_normalize(ListBase *lb); +void register_node_type_cmp_normal(struct bNodeTreeType *ttype); +void register_node_type_cmp_curve_vec(struct bNodeTreeType *ttype); +void register_node_type_cmp_map_value(struct bNodeTreeType *ttype); +void register_node_type_cmp_normalize(struct bNodeTreeType *ttype); -void register_node_type_cmp_filter(ListBase *lb); -void register_node_type_cmp_blur(ListBase *lb); -void register_node_type_cmp_dblur(ListBase *lb); -void register_node_type_cmp_bilateralblur(ListBase *lb); -void register_node_type_cmp_vecblur(ListBase *lb); -void register_node_type_cmp_dilateerode(ListBase *lb); -void register_node_type_cmp_defocus(ListBase *lb); +void register_node_type_cmp_filter(struct bNodeTreeType *ttype); +void register_node_type_cmp_blur(struct bNodeTreeType *ttype); +void register_node_type_cmp_dblur(struct bNodeTreeType *ttype); +void register_node_type_cmp_bilateralblur(struct bNodeTreeType *ttype); +void register_node_type_cmp_vecblur(struct bNodeTreeType *ttype); +void register_node_type_cmp_dilateerode(struct bNodeTreeType *ttype); +void register_node_type_cmp_defocus(struct bNodeTreeType *ttype); -void register_node_type_cmp_valtorgb(ListBase *lb); -void register_node_type_cmp_rgbtobw(ListBase *lb); -void register_node_type_cmp_setalpha(ListBase *lb); -void register_node_type_cmp_idmask(ListBase *lb); -void register_node_type_cmp_math(ListBase *lb); -void register_node_type_cmp_seprgba(ListBase *lb); -void register_node_type_cmp_combrgba(ListBase *lb); -void register_node_type_cmp_sephsva(ListBase *lb); -void register_node_type_cmp_combhsva(ListBase *lb); -void register_node_type_cmp_sepyuva(ListBase *lb); -void register_node_type_cmp_combyuva(ListBase *lb); -void register_node_type_cmp_sepycca(ListBase *lb); -void register_node_type_cmp_combycca(ListBase *lb); -void register_node_type_cmp_premulkey(ListBase *lb); +void register_node_type_cmp_valtorgb(struct bNodeTreeType *ttype); +void register_node_type_cmp_rgbtobw(struct bNodeTreeType *ttype); +void register_node_type_cmp_setalpha(struct bNodeTreeType *ttype); +void register_node_type_cmp_idmask(struct bNodeTreeType *ttype); +void register_node_type_cmp_math(struct bNodeTreeType *ttype); +void register_node_type_cmp_seprgba(struct bNodeTreeType *ttype); +void register_node_type_cmp_combrgba(struct bNodeTreeType *ttype); +void register_node_type_cmp_sephsva(struct bNodeTreeType *ttype); +void register_node_type_cmp_combhsva(struct bNodeTreeType *ttype); +void register_node_type_cmp_sepyuva(struct bNodeTreeType *ttype); +void register_node_type_cmp_combyuva(struct bNodeTreeType *ttype); +void register_node_type_cmp_sepycca(struct bNodeTreeType *ttype); +void register_node_type_cmp_combycca(struct bNodeTreeType *ttype); +void register_node_type_cmp_premulkey(struct bNodeTreeType *ttype); -void register_node_type_cmp_diff_matte(ListBase *lb); -void register_node_type_cmp_distance_matte(ListBase *lb); -void register_node_type_cmp_chroma_matte(ListBase *lb); -void register_node_type_cmp_color_matte(ListBase *lb); -void register_node_type_cmp_channel_matte(ListBase *lb); -void register_node_type_cmp_color_spill(ListBase *lb); -void register_node_type_cmp_luma_matte(ListBase *lb); +void register_node_type_cmp_diff_matte(struct bNodeTreeType *ttype); +void register_node_type_cmp_distance_matte(struct bNodeTreeType *ttype); +void register_node_type_cmp_chroma_matte(struct bNodeTreeType *ttype); +void register_node_type_cmp_color_matte(struct bNodeTreeType *ttype); +void register_node_type_cmp_channel_matte(struct bNodeTreeType *ttype); +void register_node_type_cmp_color_spill(struct bNodeTreeType *ttype); +void register_node_type_cmp_luma_matte(struct bNodeTreeType *ttype); -void register_node_type_cmp_translate(ListBase *lb); -void register_node_type_cmp_rotate(ListBase *lb); -void register_node_type_cmp_scale(ListBase *lb); -void register_node_type_cmp_flip(ListBase *lb); -void register_node_type_cmp_crop(ListBase *lb); -void register_node_type_cmp_displace(ListBase *lb); -void register_node_type_cmp_mapuv(ListBase *lb); -void register_node_type_cmp_transform(ListBase *lb); -void register_node_type_cmp_stabilize2d(ListBase *lb); -void register_node_type_cmp_moviedistortion(ListBase *lb); +void register_node_type_cmp_translate(struct bNodeTreeType *ttype); +void register_node_type_cmp_rotate(struct bNodeTreeType *ttype); +void register_node_type_cmp_scale(struct bNodeTreeType *ttype); +void register_node_type_cmp_flip(struct bNodeTreeType *ttype); +void register_node_type_cmp_crop(struct bNodeTreeType *ttype); +void register_node_type_cmp_displace(struct bNodeTreeType *ttype); +void register_node_type_cmp_mapuv(struct bNodeTreeType *ttype); +void register_node_type_cmp_transform(struct bNodeTreeType *ttype); +void register_node_type_cmp_stabilize2d(struct bNodeTreeType *ttype); +void register_node_type_cmp_moviedistortion(struct bNodeTreeType *ttype); -void register_node_type_cmp_glare(ListBase *lb); -void register_node_type_cmp_tonemap(ListBase *lb); -void register_node_type_cmp_lensdist(ListBase *lb); +void register_node_type_cmp_glare(struct bNodeTreeType *ttype); +void register_node_type_cmp_tonemap(struct bNodeTreeType *ttype); +void register_node_type_cmp_lensdist(struct bNodeTreeType *ttype); #endif diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index 996660fcb8b..293ce466574 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -43,68 +43,68 @@ extern struct bNodeTreeType ntreeType_Shader; /* the type definitions array */ /* ****************** types array for all shaders ****************** */ -void register_node_type_sh_group(ListBase *lb); -void register_node_type_sh_forloop(ListBase *lb); -void register_node_type_sh_whileloop(ListBase *lb); +void register_node_type_sh_group(struct bNodeTreeType *ttype); +void register_node_type_sh_forloop(struct bNodeTreeType *ttype); +void register_node_type_sh_whileloop(struct bNodeTreeType *ttype); -void register_node_type_sh_output(ListBase *lb); -void register_node_type_sh_material(ListBase *lb); -void register_node_type_sh_camera(ListBase *lb); -void register_node_type_sh_value(ListBase *lb); -void register_node_type_sh_rgb(ListBase *lb); -void register_node_type_sh_mix_rgb(ListBase *lb); -void register_node_type_sh_valtorgb(ListBase *lb); -void register_node_type_sh_rgbtobw(ListBase *lb); -void register_node_type_sh_texture(ListBase *lb); -void register_node_type_sh_normal(ListBase *lb); -void register_node_type_sh_geom(ListBase *lb); -void register_node_type_sh_mapping(ListBase *lb); -void register_node_type_sh_curve_vec(ListBase *lb); -void register_node_type_sh_curve_rgb(ListBase *lb); -void register_node_type_sh_math(ListBase *lb); -void register_node_type_sh_vect_math(ListBase *lb); -void register_node_type_sh_squeeze(ListBase *lb); -void register_node_type_sh_dynamic(ListBase *lb); -void register_node_type_sh_material_ext(ListBase *lb); -void register_node_type_sh_invert(ListBase *lb); -void register_node_type_sh_seprgb(ListBase *lb); -void register_node_type_sh_combrgb(ListBase *lb); -void register_node_type_sh_hue_sat(ListBase *lb); +void register_node_type_sh_output(struct bNodeTreeType *ttype); +void register_node_type_sh_material(struct bNodeTreeType *ttype); +void register_node_type_sh_camera(struct bNodeTreeType *ttype); +void register_node_type_sh_value(struct bNodeTreeType *ttype); +void register_node_type_sh_rgb(struct bNodeTreeType *ttype); +void register_node_type_sh_mix_rgb(struct bNodeTreeType *ttype); +void register_node_type_sh_valtorgb(struct bNodeTreeType *ttype); +void register_node_type_sh_rgbtobw(struct bNodeTreeType *ttype); +void register_node_type_sh_texture(struct bNodeTreeType *ttype); +void register_node_type_sh_normal(struct bNodeTreeType *ttype); +void register_node_type_sh_geom(struct bNodeTreeType *ttype); +void register_node_type_sh_mapping(struct bNodeTreeType *ttype); +void register_node_type_sh_curve_vec(struct bNodeTreeType *ttype); +void register_node_type_sh_curve_rgb(struct bNodeTreeType *ttype); +void register_node_type_sh_math(struct bNodeTreeType *ttype); +void register_node_type_sh_vect_math(struct bNodeTreeType *ttype); +void register_node_type_sh_squeeze(struct bNodeTreeType *ttype); +void register_node_type_sh_dynamic(struct bNodeTreeType *ttype); +void register_node_type_sh_material_ext(struct bNodeTreeType *ttype); +void register_node_type_sh_invert(struct bNodeTreeType *ttype); +void register_node_type_sh_seprgb(struct bNodeTreeType *ttype); +void register_node_type_sh_combrgb(struct bNodeTreeType *ttype); +void register_node_type_sh_hue_sat(struct bNodeTreeType *ttype); -void register_node_type_sh_attribute(ListBase *lb); -void register_node_type_sh_geometry(ListBase *lb); -void register_node_type_sh_light_path(ListBase *lb); -void register_node_type_sh_fresnel(ListBase *lb); -void register_node_type_sh_layer_weight(ListBase *lb); -void register_node_type_sh_tex_coord(ListBase *lb); +void register_node_type_sh_attribute(struct bNodeTreeType *ttype); +void register_node_type_sh_geometry(struct bNodeTreeType *ttype); +void register_node_type_sh_light_path(struct bNodeTreeType *ttype); +void register_node_type_sh_fresnel(struct bNodeTreeType *ttype); +void register_node_type_sh_layer_weight(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_coord(struct bNodeTreeType *ttype); -void register_node_type_sh_background(ListBase *lb); -void register_node_type_sh_bsdf_diffuse(ListBase *lb); -void register_node_type_sh_bsdf_glossy(ListBase *lb); -void register_node_type_sh_bsdf_glass(ListBase *lb); -void register_node_type_sh_bsdf_translucent(ListBase *lb); -void register_node_type_sh_bsdf_transparent(ListBase *lb); -void register_node_type_sh_bsdf_velvet(ListBase *lb); -void register_node_type_sh_emission(ListBase *lb); -void register_node_type_sh_holdout(ListBase *lb); -void register_node_type_sh_volume_transparent(ListBase *lb); -void register_node_type_sh_volume_isotropic(ListBase *lb); -void register_node_type_sh_mix_shader(ListBase *lb); -void register_node_type_sh_add_shader(ListBase *lb); +void register_node_type_sh_background(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_diffuse(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_glossy(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_glass(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_translucent(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_transparent(struct bNodeTreeType *ttype); +void register_node_type_sh_bsdf_velvet(struct bNodeTreeType *ttype); +void register_node_type_sh_emission(struct bNodeTreeType *ttype); +void register_node_type_sh_holdout(struct bNodeTreeType *ttype); +void register_node_type_sh_volume_transparent(struct bNodeTreeType *ttype); +void register_node_type_sh_volume_isotropic(struct bNodeTreeType *ttype); +void register_node_type_sh_mix_shader(struct bNodeTreeType *ttype); +void register_node_type_sh_add_shader(struct bNodeTreeType *ttype); -void register_node_type_sh_output_lamp(ListBase *lb); -void register_node_type_sh_output_material(ListBase *lb); -void register_node_type_sh_output_world(ListBase *lb); +void register_node_type_sh_output_lamp(struct bNodeTreeType *ttype); +void register_node_type_sh_output_material(struct bNodeTreeType *ttype); +void register_node_type_sh_output_world(struct bNodeTreeType *ttype); -void register_node_type_sh_tex_image(ListBase *lb); -void register_node_type_sh_tex_environment(ListBase *lb); -void register_node_type_sh_tex_sky(ListBase *lb); -void register_node_type_sh_tex_voronoi(ListBase *lb); -void register_node_type_sh_tex_gradient(ListBase *lb); -void register_node_type_sh_tex_magic(ListBase *lb); -void register_node_type_sh_tex_wave(ListBase *lb); -void register_node_type_sh_tex_musgrave(ListBase *lb); -void register_node_type_sh_tex_noise(ListBase *lb); +void register_node_type_sh_tex_image(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_environment(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_sky(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_voronoi(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_gradient(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_magic(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_wave(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_musgrave(struct bNodeTreeType *ttype); +void register_node_type_sh_tex_noise(struct bNodeTreeType *ttype); #endif diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h index b07c0b22b75..b3fdbf0e250 100644 --- a/source/blender/nodes/NOD_texture.h +++ b/source/blender/nodes/NOD_texture.h @@ -42,45 +42,45 @@ extern bNodeTreeType ntreeType_Texture; /* ****************** types array for all texture nodes ****************** */ -void register_node_type_tex_group(ListBase *lb); -void register_node_type_tex_forloop(ListBase *lb); -void register_node_type_tex_whileloop(ListBase *lb); +void register_node_type_tex_group(struct bNodeTreeType *ttype); +void register_node_type_tex_forloop(struct bNodeTreeType *ttype); +void register_node_type_tex_whileloop(struct bNodeTreeType *ttype); -void register_node_type_tex_math(ListBase *lb); -void register_node_type_tex_mix_rgb(ListBase *lb); -void register_node_type_tex_valtorgb(ListBase *lb); -void register_node_type_tex_valtonor(ListBase *lb); -void register_node_type_tex_rgbtobw(ListBase *lb); -void register_node_type_tex_output(ListBase *lb); -void register_node_type_tex_viewer(ListBase *lb); -void register_node_type_tex_checker(ListBase *lb); -void register_node_type_tex_texture(ListBase *lb); -void register_node_type_tex_bricks(ListBase *lb); -void register_node_type_tex_image(ListBase *lb); -void register_node_type_tex_curve_rgb(ListBase *lb); -void register_node_type_tex_curve_time(ListBase *lb); -void register_node_type_tex_invert(ListBase *lb); -void register_node_type_tex_hue_sat(ListBase *lb); -void register_node_type_tex_coord(ListBase *lb); -void register_node_type_tex_distance(ListBase *lb); +void register_node_type_tex_math(struct bNodeTreeType *ttype); +void register_node_type_tex_mix_rgb(struct bNodeTreeType *ttype); +void register_node_type_tex_valtorgb(struct bNodeTreeType *ttype); +void register_node_type_tex_valtonor(struct bNodeTreeType *ttype); +void register_node_type_tex_rgbtobw(struct bNodeTreeType *ttype); +void register_node_type_tex_output(struct bNodeTreeType *ttype); +void register_node_type_tex_viewer(struct bNodeTreeType *ttype); +void register_node_type_tex_checker(struct bNodeTreeType *ttype); +void register_node_type_tex_texture(struct bNodeTreeType *ttype); +void register_node_type_tex_bricks(struct bNodeTreeType *ttype); +void register_node_type_tex_image(struct bNodeTreeType *ttype); +void register_node_type_tex_curve_rgb(struct bNodeTreeType *ttype); +void register_node_type_tex_curve_time(struct bNodeTreeType *ttype); +void register_node_type_tex_invert(struct bNodeTreeType *ttype); +void register_node_type_tex_hue_sat(struct bNodeTreeType *ttype); +void register_node_type_tex_coord(struct bNodeTreeType *ttype); +void register_node_type_tex_distance(struct bNodeTreeType *ttype); -void register_node_type_tex_rotate(ListBase *lb); -void register_node_type_tex_translate(ListBase *lb); -void register_node_type_tex_scale(ListBase *lb); -void register_node_type_tex_at(ListBase *lb); +void register_node_type_tex_rotate(struct bNodeTreeType *ttype); +void register_node_type_tex_translate(struct bNodeTreeType *ttype); +void register_node_type_tex_scale(struct bNodeTreeType *ttype); +void register_node_type_tex_at(struct bNodeTreeType *ttype); -void register_node_type_tex_compose(ListBase *lb); -void register_node_type_tex_decompose(ListBase *lb); +void register_node_type_tex_compose(struct bNodeTreeType *ttype); +void register_node_type_tex_decompose(struct bNodeTreeType *ttype); -void register_node_type_tex_proc_voronoi(ListBase *lb); -void register_node_type_tex_proc_blend(ListBase *lb); -void register_node_type_tex_proc_magic(ListBase *lb); -void register_node_type_tex_proc_marble(ListBase *lb); -void register_node_type_tex_proc_clouds(ListBase *lb); -void register_node_type_tex_proc_wood(ListBase *lb); -void register_node_type_tex_proc_musgrave(ListBase *lb); -void register_node_type_tex_proc_noise(ListBase *lb); -void register_node_type_tex_proc_stucci(ListBase *lb); -void register_node_type_tex_proc_distnoise(ListBase *lb); +void register_node_type_tex_proc_voronoi(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_blend(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_magic(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_marble(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_clouds(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_wood(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_musgrave(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_noise(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_stucci(struct bNodeTreeType *ttype); +void register_node_type_tex_proc_distnoise(struct bNodeTreeType *ttype); #endif diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index 4fd4b750178..cad85d33a66 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -143,19 +143,16 @@ static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemp node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); } -void register_node_type_cmp_alphaover(ListBase *lb) +void register_node_type_cmp_alphaover(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); node_type_size(&ntype, 80, 40, 120); node_type_init(&ntype, node_alphaover_init); node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_alphaover); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index 0f341335783..c6462e2870c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -258,17 +258,16 @@ static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode* no nbbd->sigma_space= 5.0; } -void register_node_type_cmp_bilateralblur(ListBase *lb) +void register_node_type_cmp_bilateralblur(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_bilateralblur); node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_bilateralblur); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 816aacbe61c..76827f719f5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -716,19 +716,16 @@ static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode* node, bNode node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data"); } -void register_node_type_cmp_blur(ListBase *lb) +void register_node_type_cmp_blur(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out); node_type_size(&ntype, 120, 80, 200); node_type_init(&ntype, node_composit_init_blur); node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_blur); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 9153e3899fc..d935d9af7f7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -94,15 +94,14 @@ static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, b } } -void register_node_type_cmp_brightcontrast(ListBase *lb) +void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_brightcontrast); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 6597ceaeee2..785786dacbe 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -200,16 +200,16 @@ static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode* no node->custom2= 2; /* Green Channel */ } -void register_node_type_cmp_channel_matte(ListBase *lb) +void register_node_type_cmp_channel_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out); node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_channel_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_channel_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 0005d9d2cc9..b6f490a0320 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -187,19 +187,16 @@ static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode* nod c->fstrength= 1.0f; } -void register_node_type_cmp_chroma_matte(ListBase *lb) +void register_node_type_cmp_chroma_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out); node_type_size(&ntype, 200, 80, 300); node_type_init(&ntype, node_composit_init_chroma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_chroma_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index 66dc9ff0304..2d56c9e5973 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -123,19 +123,16 @@ static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode* node c->fstrength= 1.0f; } -void register_node_type_cmp_color_matte(ListBase *lb) +void register_node_type_cmp_color_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out); node_type_size(&ntype, 200, 80, 300); node_type_init(&ntype, node_composit_init_color_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_color_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index c85a81b9bdb..af6a295cf7f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -324,16 +324,16 @@ static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode* node ncs->unspill=0; /* do not use unspill */ } -void register_node_type_cmp_color_spill(ListBase *lb) +void register_node_type_cmp_color_spill(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out); node_type_size(&ntype, 140, 80, 200); node_type_init(&ntype, node_composit_init_color_spill); node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_color_spill); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index f7de5801a5e..26d7aa0a3a0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -182,18 +182,16 @@ static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode* nod n->gain[0] = n->gain[1] = n->gain[2] = 1.0f; } -void register_node_type_cmp_colorbalance(ListBase *lb) +void register_node_type_cmp_colorbalance(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_colorbalance_in, cmp_node_colorbalance_out); node_type_size(&ntype, 400, 200, 400); node_type_init(&ntype, node_composit_init_colorbalance); node_type_storage(&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_colorbalance); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index 7060971830e..1b38609ce24 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -206,11 +206,11 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node group_move_outputs(node, out, exec->stack); } -void register_node_type_cmp_group(ListBase *lb) +void register_node_type_cmp_group(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); + node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -221,7 +221,7 @@ void register_node_type_cmp_group(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -290,11 +290,11 @@ static void forloop_execute(void *data, int thread, struct bNode *node, void *no group_move_outputs(node, out, exec->stack); } -void register_node_type_cmp_forloop(ListBase *lb) +void register_node_type_cmp_forloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -306,7 +306,7 @@ void register_node_type_cmp_forloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif @@ -351,11 +351,11 @@ static void whileloop_execute(void *data, int thread, struct bNode *node, void * group_move_outputs(node, out, exec->stack); } -void register_node_type_cmp_whileloop(ListBase *lb) +void register_node_type_cmp_whileloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -367,6 +367,6 @@ void register_node_type_cmp_whileloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 4eb9dd74b2e..828dd8fcfc7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -97,15 +97,14 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i generate_preview(data, node, in[0]->data); } -void register_node_type_cmp_composite(ListBase *lb) +void register_node_type_cmp_composite(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_composite_in, NULL); node_type_size(&ntype, 80, 60, 200); node_type_exec(&ntype, node_composit_exec_composite); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c index 7847726c68e..3697f3e4c5c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ b/source/blender/nodes/composite/nodes/node_composite_crop.c @@ -111,17 +111,16 @@ static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode* node, bNode nxy->y2= 0; } -void register_node_type_cmp_crop(ListBase *lb) +void register_node_type_cmp_crop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_crop); node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_crop); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 2e54836e042..81424586a11 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -62,23 +62,22 @@ static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode* node node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_cmp_curve_time(ListBase *lb) +void register_node_type_cmp_curve_time(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_time_out); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_curves_time); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, node_composit_exec_curves_time); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - /* **************** CURVE VEC ******************** */ static bNodeSocketTemplate cmp_node_curve_vec_in[]= { { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, @@ -103,18 +102,18 @@ static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode* node, node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); } -void register_node_type_cmp_curve_vec(ListBase *lb) +void register_node_type_cmp_curve_vec(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_curve_vec_in, cmp_node_curve_vec_out); node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curve_vec); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, node_composit_exec_curve_vec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -190,18 +189,16 @@ static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode* node, node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_cmp_curve_rgb(ListBase *lb) +void register_node_type_cmp_curve_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_curve_rgb_in, cmp_node_curve_rgb_out); node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curve_rgb); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, node_composit_exec_curve_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index f1c2fb321d1..1e7c8e8b58c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -875,19 +875,16 @@ static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bN node->storage = nbd; } -void register_node_type_cmp_defocus(ListBase *lb) +void register_node_type_cmp_defocus(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_defocus); node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_defocus); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 3b2a2342167..eae59dea3f4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -131,19 +131,16 @@ static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode* node, c->t2= 0.1f; } -void register_node_type_cmp_diff_matte(ListBase *lb) +void register_node_type_cmp_diff_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out); node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_diff_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_diff_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index 751db641785..f8abf96e742 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -146,16 +146,14 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod } } -void register_node_type_cmp_dilateerode(ListBase *lb) +void register_node_type_cmp_dilateerode(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out); node_type_size(&ntype, 130, 100, 320); node_type_exec(&ntype, node_composit_exec_dilateerode); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 04610150356..d0f7feccf2e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -130,17 +130,16 @@ static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode* node, bNod ndbd->center_y= 0.5; } -void register_node_type_cmp_dblur(ListBase *lb) +void register_node_type_cmp_dblur(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_dblur); node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_dblur); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index a55a6093f12..ad7c1fa589e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -182,16 +182,14 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_displace(ListBase *lb) +void register_node_type_cmp_displace(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_displace); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index 27fe66cbe0d..292bb66613d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -128,19 +128,16 @@ static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode* n c->t2= 0.1f; } -void register_node_type_cmp_distance_matte(ListBase *lb) +void register_node_type_cmp_distance_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out); node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_distance_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_distance_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 1a0c51fab53..94a109de8f2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -220,18 +220,15 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, } -void register_node_type_cmp_filter(ListBase *lb) +void register_node_type_cmp_filter(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out); node_type_size(&ntype, 80, 40, 120); node_type_label(&ntype, node_filter_label); node_type_exec(&ntype, node_composit_exec_filter); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c index 01f58182227..974a14037eb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ b/source/blender/nodes/composite/nodes/node_composite_flip.c @@ -88,17 +88,14 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack } } -void register_node_type_cmp_flip(ListBase *lb) +void register_node_type_cmp_flip(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_flip); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index ad377799dea..90135b5cf35 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -75,14 +75,14 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack } } -void register_node_type_cmp_gamma(ListBase *lb) +void register_node_type_cmp_gamma(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_gamma); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index 296ad2e3a5b..d4e15f780e5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -489,17 +489,16 @@ static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode* node, bNod node->storage = ndg; } -void register_node_type_cmp_glare(ListBase *lb) +void register_node_type_cmp_glare(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_glare); node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_glare); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 711560a0a94..c4598717e00 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -102,19 +102,16 @@ static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode* node, bN nhs->val= 1.0f; } -void register_node_type_cmp_hue_sat(ListBase *lb) +void register_node_type_cmp_hue_sat(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out); node_type_size(&ntype, 150, 80, 250); node_type_init(&ntype, node_composit_init_hue_sat); node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_hue_sat); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index acb70f13ec2..6b0849b2391 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -151,18 +151,16 @@ static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode* node, cumapping->cur = 1; } -void register_node_type_cmp_huecorrect(ListBase *lb) +void register_node_type_cmp_huecorrect(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out); node_type_size(&ntype, 320, 140, 400); node_type_init(&ntype, node_composit_init_huecorrect); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, node_composit_exec_huecorrect); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index 914483bc52f..0600e44b0d0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -107,17 +107,14 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, } -void register_node_type_cmp_idmask(ListBase *lb) +void register_node_type_cmp_idmask(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_idmask); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 672d2af0646..9920cdab039 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -314,18 +314,18 @@ static void node_composit_init_image(bNodeTree *UNUSED(ntree), bNode* node, bNod iuser->ok= 1; } -void register_node_type_cmp_image(ListBase *lb) +void register_node_type_cmp_image(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out); node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, node_composit_init_image); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_image); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -445,17 +445,14 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU } -void register_node_type_cmp_rlayers(ListBase *lb) +void register_node_type_cmp_rlayers(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out); node_type_size(&ntype, 150, 100, 300); node_type_exec(&ntype, node_composit_exec_rlayers); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index d98f5a1c64b..4fda90e0a1e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -118,16 +118,15 @@ static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode* node, bNo } /* custom1 = mix type */ -void register_node_type_cmp_invert(ListBase *lb) +void register_node_type_cmp_invert(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out); node_type_size(&ntype, 120, 120, 140); node_type_init(&ntype, node_composit_init_invert); node_type_exec(&ntype, node_composit_exec_invert); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c index e57f405ed68..5d3a9323f52 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c @@ -190,17 +190,16 @@ static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode* node, b } -void register_node_type_cmp_lensdist(ListBase *lb) +void register_node_type_cmp_lensdist(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_lensdist); node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_lensdist); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index f3e4f0db8b6..9417e504a1b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -320,18 +320,16 @@ static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode* node node->custom1=1; /*All channels*/ } -void register_node_type_cmp_view_levels(ListBase *lb) +void register_node_type_cmp_view_levels(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW); + node_type_base(ttype, &ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_view_levels); node_type_storage(&ntype, "ImageUser", NULL, NULL); node_type_exec(&ntype, node_composit_exec_view_levels); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index 8573849b069..ad5e9d423e5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -104,18 +104,16 @@ static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode* node, c->t2= 0.0f; } -void register_node_type_cmp_luma_matte(ListBase *lb) +void register_node_type_cmp_luma_matte(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out); node_type_size(&ntype, 200, 80, 250); node_type_init(&ntype, node_composit_init_luma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_luma_matte); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index b596f67a886..1ca729c8393 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -162,17 +162,14 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack } } -void register_node_type_cmp_mapuv(ListBase *lb) +void register_node_type_cmp_mapuv(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_mapuv); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c index 6930fbf0664..380aa0b716b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c @@ -82,20 +82,16 @@ static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode* node, node->storage= add_tex_mapping(); } -void register_node_type_cmp_map_value(ListBase *lb) +void register_node_type_cmp_map_value(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out); node_type_size(&ntype, 100, 60, 150); node_type_init(&ntype, node_composit_init_map_value); node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_map_value); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index 27fdcfc1d4e..6c2cbb9a92b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -194,19 +194,15 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack out[0]->data= stackbuf; } -void register_node_type_cmp_math(ListBase *lb) +void register_node_type_cmp_math(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); node_type_size(&ntype, 120, 110, 160); node_type_label(&ntype, node_math_label); node_type_exec(&ntype, node_composit_exec_math); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index 275d949da28..4a303e911e2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -82,16 +82,15 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, } /* custom1 = mix type */ -void register_node_type_cmp_mix_rgb(ListBase *lb) +void register_node_type_cmp_mix_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); node_type_size(&ntype, 110, 60, 120); node_type_label(&ntype, node_blend_label); node_type_exec(&ntype, node_composit_exec_mix_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c index 8931b899017..1f449f8c16a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c @@ -142,16 +142,16 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(nt user->framenr= 1; } -void register_node_type_cmp_movieclip(ListBase *lb) +void register_node_type_cmp_movieclip(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_movieclip_out); node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, init); node_type_storage(&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_movieclip); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index 05d13f346f3..bc3f648a374 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -124,16 +124,16 @@ static void storage_copy(bNode *orig_node, bNode *new_node) new_node->storage= BKE_tracking_distortion_copy(orig_node->storage); } -void register_node_type_cmp_moviedistortion(ListBase *lb) +void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); node_type_size(&ntype, 140, 100, 320); node_type_label(&ntype, label); node_type_exec(&ntype, exec); node_type_storage(&ntype, NULL, storage_free, storage_copy); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c index 4c43871d867..fbbd58932ea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.c +++ b/source/blender/nodes/composite/nodes/node_composite_normal.c @@ -91,17 +91,15 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(nt nor[2] = 1.0f; } -void register_node_type_cmp_normal(ListBase *lb) +void register_node_type_cmp_normal(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out); node_type_init(&ntype, init); node_type_size(&ntype, 100, 60, 200); node_type_exec(&ntype, node_composit_exec_normal); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c index d14f589f3f2..455966e4f38 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c @@ -101,14 +101,14 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS } } -void register_node_type_cmp_normalize(ListBase *lb) +void register_node_type_cmp_normalize(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out); node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, node_composit_exec_normalize); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 845c5b88020..b2177002e82 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -108,19 +108,16 @@ static void node_composit_init_output_file(bNodeTree *UNUSED(ntree), bNode* node } } -void register_node_type_cmp_output_file(ListBase *lb) +void register_node_type_cmp_output_file(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_output_file_in, NULL); node_type_size(&ntype, 140, 80, 300); node_type_init(&ntype, node_composit_init_output_file); node_type_storage(&ntype, "NodeImageFile", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_output_file); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c index b188b0dd323..bf934fcd0f7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c @@ -61,16 +61,14 @@ static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeS } } -void register_node_type_cmp_premulkey(ListBase *lb) +void register_node_type_cmp_premulkey(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_premulkey); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c index 12f073a816d..ca9db716b66 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c @@ -58,18 +58,15 @@ static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack * copy_v4_v4(out[0]->vec, col); } -void register_node_type_cmp_rgb(ListBase *lb) +void register_node_type_cmp_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out); node_type_init(&ntype, node_composit_init_rgb); node_type_size(&ntype, 140, 80, 140); node_type_exec(&ntype, node_composit_exec_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index d02602c7d04..826653c6cff 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -126,16 +126,15 @@ static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode* node, bNo node->custom1= 1; /* Bilinear Filter*/ } -void register_node_type_cmp_rotate(ListBase *lb) +void register_node_type_cmp_rotate(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_rotate); node_type_exec(&ntype, node_composit_exec_rotate); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 37332c9bd7e..188449df5fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -129,21 +129,14 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b } } -void register_node_type_cmp_scale(ListBase *lb) +void register_node_type_cmp_scale(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_scale); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - - - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index bf58d443aec..d742a916fdf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -99,16 +99,16 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta } } -void register_node_type_cmp_sephsva(ListBase *lb) +void register_node_type_cmp_sephsva(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_sephsva); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -169,17 +169,14 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_combhsva(ListBase *lb) +void register_node_type_cmp_combhsva(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_combhsva); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c index ade2b22bf35..1f0b504f161 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c @@ -77,16 +77,16 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), } } -void register_node_type_cmp_seprgba(ListBase *lb) +void register_node_type_cmp_seprgba(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_seprgba); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -145,16 +145,14 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_combrgba(ListBase *lb) +void register_node_type_cmp_combrgba(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_combrgba); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 7944176c5d3..a5f827b094d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -148,16 +148,16 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } } -void register_node_type_cmp_sepycca(ListBase *lb) +void register_node_type_cmp_sepycca(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_sepycca); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -295,17 +295,14 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_combycca(ListBase *lb) +void register_node_type_cmp_combycca(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_combycca); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c index aedb5652e61..2a2f64a5209 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c @@ -99,16 +99,16 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta } } -void register_node_type_cmp_sepyuva(ListBase *lb) +void register_node_type_cmp_sepyuva(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_sepyuva); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -170,16 +170,14 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_combyuva(ListBase *lb) +void register_node_type_cmp_combyuva(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_composit_exec_combyuva); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c index 2b19ebfe5a3..6c24185bb88 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c @@ -73,15 +73,14 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt } } -void register_node_type_cmp_setalpha(ListBase *lb) +void register_node_type_cmp_setalpha(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out); node_type_size(&ntype, 120, 40, 140); node_type_exec(&ntype, node_composit_exec_setalpha); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index b63b42224e2..c801c34e8b5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -149,21 +149,16 @@ static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode* node node->custom1= 50; /* default 50% split */ } -void register_node_type_cmp_splitviewer(ListBase *lb) +void register_node_type_cmp_splitviewer(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_splitviewer); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c index c5d60e65530..f41751b3e15 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c @@ -66,14 +66,14 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack * } } -void register_node_type_cmp_stabilize2d(ListBase *lb) +void register_node_type_cmp_stabilize2d(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_stabilize2d); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c index 2f54f27e481..7f8f14bcfc5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.c +++ b/source/blender/nodes/composite/nodes/node_composite_texture.c @@ -142,17 +142,14 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, } } -void register_node_type_cmp_texture(ListBase *lb) +void register_node_type_cmp_texture(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); + node_type_base(ttype, &ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out); node_type_size(&ntype, 120, 80, 240); node_type_exec(&ntype, node_composit_exec_texture); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index 36e583a77ff..9b34e117496 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -162,17 +162,16 @@ static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode* node, bN node->storage = ntm; } -void register_node_type_cmp_tonemap(ListBase *lb) +void register_node_type_cmp_tonemap(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out); node_type_size(&ntype, 150, 120, 200); node_type_init(&ntype, node_composit_init_tonemap); node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_tonemap); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c index de9b8fceaee..7e096bf0545 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.c +++ b/source/blender/nodes/composite/nodes/node_composite_transform.c @@ -127,16 +127,14 @@ static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeS } } -void register_node_type_cmp_transform(ListBase *lb) +void register_node_type_cmp_transform(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_transform); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c index 2b25ef92a1e..073b035add0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ b/source/blender/nodes/composite/nodes/node_composite_translate.c @@ -59,16 +59,14 @@ static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node) } } -void register_node_type_cmp_translate(ListBase *lb) +void register_node_type_cmp_translate(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, node_composit_exec_translate); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c index 014f40a1a48..30f624641d1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c @@ -83,18 +83,18 @@ static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode* node, b node->storage= add_colorband(1); } -void register_node_type_cmp_valtorgb(ListBase *lb) +void register_node_type_cmp_valtorgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out); node_type_size(&ntype, 240, 200, 300); node_type_init(&ntype, node_composit_init_valtorgb); node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_valtorgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -137,14 +137,14 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta } } -void register_node_type_cmp_rgbtobw(ListBase *lb) +void register_node_type_cmp_rgbtobw(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_composit_exec_rgbtobw); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c index a38187847fd..3cecb69bc7e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_value.c +++ b/source/blender/nodes/composite/nodes/node_composite_value.c @@ -57,17 +57,15 @@ static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack out[0]->vec[0]= val; } -void register_node_type_cmp_value(ListBase *lb) +void register_node_type_cmp_value(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_value_out); node_type_init(&ntype, node_composit_init_value); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_composit_exec_value); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c index a0fbcec198a..69f896e9bb5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c @@ -94,18 +94,16 @@ static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode* node, bN } /* custom1: itterations, custom2: maxspeed (0 = nolimit) */ -void register_node_type_cmp_vecblur(ListBase *lb) +void register_node_type_cmp_vecblur(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out); node_type_size(&ntype, 120, 80, 200); node_type_init(&ntype, node_composit_init_vecblur); node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_vecblur); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index fcf7fe530bd..46051caced2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -131,16 +131,16 @@ static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode* node, bNo iuser->ok= 1; } -void register_node_type_cmp_viewer(ListBase *lb) +void register_node_type_cmp_viewer(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL); node_type_size(&ntype, 80, 60, 200); node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_viewer); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c index 868c0d2b5f3..57b0b7bbf14 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c @@ -222,15 +222,14 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in } -void register_node_type_cmp_zcombine(ListBase *lb) +void register_node_type_cmp_zcombine(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_composit_exec_zcombine); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 11dcf44a288..5ad84da45d2 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -973,15 +973,15 @@ bNodeTemplate node_whileloop_template(bNode *node) /**** FRAME ****/ -void register_node_type_frame(ListBase *lb) +void register_node_type_frame(bNodeTreeType *ttype) { /* frame type is used for all tree types, needs dynamic allocation */ bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type"); - node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND); + node_type_base(ttype, ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND); node_type_size(ntype, 150, 100, 0); node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); ntype->needs_free = 1; - nodeRegisterType(lb, ntype); + nodeRegisterType(ttype, ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c index cddf49dd4d5..c12ff54d24c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c @@ -46,11 +46,11 @@ static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *UNUSED(node), GPU } /* node type definition */ -void register_node_type_sh_add_shader(ListBase *lb) +void register_node_type_sh_add_shader(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_add_shader_in, sh_node_add_shader_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_add_shader(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_add_shader); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index 6fb21f123fb..bd0779ae5b1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -43,11 +43,11 @@ static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode* node, bN } /* node type definition */ -void register_node_type_sh_attribute(ListBase *lb) +void register_node_type_sh_attribute(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_attribute_out); node_type_size(&ntype, 150, 60, 200); @@ -56,6 +56,5 @@ void register_node_type_sh_attribute(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c index 2cdd99da65c..6acdc5baa59 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.c +++ b/source/blender/nodes/shader/nodes/node_shader_background.c @@ -41,11 +41,11 @@ static bNodeSocketTemplate sh_node_background_out[]= { }; /* node type definition */ -void register_node_type_sh_background(ListBase *lb) +void register_node_type_sh_background(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_background_in, sh_node_background_out); node_type_size(&ntype, 150, 60, 200); @@ -54,6 +54,5 @@ void register_node_type_sh_background(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c index e19d867a057..2fd41fed92f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c @@ -47,11 +47,11 @@ static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node } /* node type definition */ -void register_node_type_sh_bsdf_anisotropic(ListBase *lb) +void register_node_type_sh_bsdf_anisotropic(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Glossy Anisotropic BSDF", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BSDF_ANISOTROPIC, "Glossy Anisotropic BSDF", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out); node_type_size(&ntype, 150, 60, 200); @@ -60,6 +60,5 @@ void register_node_type_sh_bsdf_anisotropic(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c index cbc82969588..114581f8a20 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -46,11 +46,11 @@ static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), G } /* node type definition */ -void register_node_type_sh_bsdf_diffuse(ListBase *lb) +void register_node_type_sh_bsdf_diffuse(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_diffuse_in, sh_node_bsdf_diffuse_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_bsdf_diffuse(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c index 2652385e273..89d469a6a4d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -47,11 +47,11 @@ static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPU } /* node type definition */ -void register_node_type_sh_bsdf_glass(ListBase *lb) +void register_node_type_sh_bsdf_glass(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out); node_type_size(&ntype, 150, 60, 200); @@ -60,6 +60,5 @@ void register_node_type_sh_bsdf_glass(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_glass); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c index 03c1ca29de1..000a211805b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -47,11 +47,11 @@ static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GP } /* node type definition */ -void register_node_type_sh_bsdf_glossy(ListBase *lb) +void register_node_type_sh_bsdf_glossy(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out); node_type_size(&ntype, 150, 60, 200); @@ -60,6 +60,5 @@ void register_node_type_sh_bsdf_glossy(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c index 74db25f3b13..60fe847ac11 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c @@ -45,11 +45,11 @@ static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node } /* node type definition */ -void register_node_type_sh_bsdf_translucent(ListBase *lb) +void register_node_type_sh_bsdf_translucent(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_translucent_in, sh_node_bsdf_translucent_out); node_type_size(&ntype, 150, 60, 200); @@ -58,6 +58,5 @@ void register_node_type_sh_bsdf_translucent(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_translucent); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c index c74786441f0..301e6dfabab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c @@ -45,11 +45,11 @@ static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *UNUSED(node } /* node type definition */ -void register_node_type_sh_bsdf_transparent(ListBase *lb) +void register_node_type_sh_bsdf_transparent(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_transparent_in, sh_node_bsdf_transparent_out); node_type_size(&ntype, 150, 60, 200); @@ -58,6 +58,5 @@ void register_node_type_sh_bsdf_transparent(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_transparent); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c index 7ca38fc0af7..fefcf4caeaf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c @@ -46,11 +46,11 @@ static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GP } /* node type definition */ -void register_node_type_sh_bsdf_velvet(ListBase *lb) +void register_node_type_sh_bsdf_velvet(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_velvet_in, sh_node_bsdf_velvet_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_bsdf_velvet(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_bsdf_velvet); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 02efbd63aba..d95cc1460df 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -57,11 +57,11 @@ static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); } -void register_node_type_sh_camera(ListBase *lb) +void register_node_type_sh_camera(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_camera_out); node_type_size(&ntype, 95, 95, 120); @@ -69,7 +69,5 @@ void register_node_type_sh_camera(ListBase *lb) node_type_exec(&ntype, node_shader_exec_camera); node_type_gpu(&ntype, gpu_shader_camera); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c index ff995e02ca6..f75cecfe83b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.c +++ b/source/blender/nodes/shader/nodes/node_shader_common.c @@ -180,11 +180,11 @@ static int gpu_group_execute(GPUMaterial *mat, bNode *node, void *nodedata, GPUN return 1; } -void register_node_type_sh_group(ListBase *lb) +void register_node_type_sh_group(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); + node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -196,7 +196,7 @@ void register_node_type_sh_group(ListBase *lb) node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute); node_type_gpu_ext(&ntype, gpu_group_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -242,11 +242,11 @@ static void forloop_execute(void *data, int thread, struct bNode *node, void *no ntreeReleaseThreadStack(nts); } -void register_node_type_sh_forloop(ListBase *lb) +void register_node_type_sh_forloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -258,7 +258,7 @@ void register_node_type_sh_forloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif @@ -304,11 +304,11 @@ static void whileloop_execute(void *data, int thread, struct bNode *node, void * ntreeReleaseThreadStack(nts); } -void register_node_type_sh_whileloop(ListBase *lb) +void register_node_type_sh_whileloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -320,6 +320,6 @@ void register_node_type_sh_whileloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index 7ac05bb28bf..d30434f4e32 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -69,11 +69,11 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array)); } -void register_node_type_sh_curve_vec(ListBase *lb) +void register_node_type_sh_curve_vec(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out); node_type_size(&ntype, 200, 140, 320); @@ -82,7 +82,7 @@ void register_node_type_sh_curve_vec(ListBase *lb) node_type_exec(&ntype, node_shader_exec_curve_vec); node_type_gpu(&ntype, gpu_shader_curve_vec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -124,11 +124,11 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array)); } -void register_node_type_sh_curve_rgb(ListBase *lb) +void register_node_type_sh_curve_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out); node_type_size(&ntype, 200, 140, 320); @@ -137,6 +137,5 @@ void register_node_type_sh_curve_rgb(ListBase *lb) node_type_exec(&ntype, node_shader_exec_curve_rgb); node_type_gpu(&ntype, gpu_shader_curve_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c index 51ddb865c54..5e7c99f7276 100644 --- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c +++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c @@ -761,32 +761,30 @@ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNode #endif } -void register_node_type_sh_dynamic(ListBase *lb) +void register_node_type_sh_dynamic(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, NULL, NULL); + node_type_base(ttype, &ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, NULL, NULL); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_size(&ntype, 150, 60, 300); node_type_init(&ntype, node_dynamic_init_cb); node_type_storage(&ntype, "NodeScriptDict", node_dynamic_free_storage_cb, node_dynamic_copy_cb); node_type_exec(&ntype, node_dynamic_exec_cb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #else -void register_node_type_sh_dynamic(ListBase *lb) +void register_node_type_sh_dynamic(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, 0); + node_type_base(ttype, &ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, 0); node_type_compatibility(&ntype, NODE_OLD_SHADING); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif - - diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c index 9b9d95086ce..9eb8fc98c69 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.c +++ b/source/blender/nodes/shader/nodes/node_shader_emission.c @@ -46,11 +46,11 @@ static int node_shader_gpu_emission(GPUMaterial *mat, bNode *UNUSED(node), GPUNo } /* node type definition */ -void register_node_type_sh_emission(ListBase *lb) +void register_node_type_sh_emission(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_emission_in, sh_node_emission_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_emission(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_emission); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c index b98fa191beb..8e5350c2167 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -45,11 +45,11 @@ static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), GPUNod } /* node type definition */ -void register_node_type_sh_fresnel(ListBase *lb) +void register_node_type_sh_fresnel(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_fresnel_in, sh_node_fresnel_out); node_type_size(&ntype, 150, 60, 200); @@ -58,6 +58,5 @@ void register_node_type_sh_fresnel(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_fresnel); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index 6547194b33a..2b28eae4085 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -138,11 +138,11 @@ static int gpu_shader_geom(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN } /* node type definition */ -void register_node_type_sh_geom(ListBase *lb) +void register_node_type_sh_geom(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_geom_out); node_type_size(&ntype, 120, 80, 160); @@ -151,6 +151,5 @@ void register_node_type_sh_geom(ListBase *lb) node_type_exec(&ntype, node_shader_exec_geom); node_type_gpu(&ntype, gpu_shader_geom); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c index 2bbdf3c23bb..6b576b0c0d1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.c +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c @@ -48,11 +48,11 @@ static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), GPUNo } /* node type definition */ -void register_node_type_sh_geometry(ListBase *lb) +void register_node_type_sh_geometry(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_geometry_out); node_type_size(&ntype, 120, 60, 200); @@ -61,6 +61,5 @@ void register_node_type_sh_geometry(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_geometry); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c index f08217f3a92..81dceafe21f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.c +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c @@ -40,11 +40,11 @@ static bNodeSocketTemplate sh_node_holdout_out[]= { /* node type definition */ -void register_node_type_sh_holdout(ListBase *lb) +void register_node_type_sh_holdout(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_holdout_in, sh_node_holdout_out); node_type_size(&ntype, 150, 60, 200); @@ -53,6 +53,5 @@ void register_node_type_sh_holdout(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c index 1207196381d..bfdcb5d0917 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c @@ -80,19 +80,16 @@ static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "hue_sat", in, out); } -void register_node_type_sh_hue_sat(ListBase *lb) +void register_node_type_sh_hue_sat(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out); node_type_size(&ntype, 150, 80, 250); node_type_exec(&ntype, node_shader_exec_hue_sat); node_type_gpu(&ntype, gpu_shader_hue_sat); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - - diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c index e3dacefbcf2..6d21b93fb65 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.c +++ b/source/blender/nodes/shader/nodes/node_shader_invert.c @@ -72,18 +72,16 @@ static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "invert", in, out); } -void register_node_type_sh_invert(ListBase *lb) +void register_node_type_sh_invert(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out); node_type_size(&ntype, 90, 80, 100); node_type_exec(&ntype, node_shader_exec_invert); node_type_gpu(&ntype, gpu_shader_invert); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c index 39c7173bd16..bcd7fb8639d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -46,11 +46,11 @@ static int node_shader_gpu_layer_weight(GPUMaterial *UNUSED(mat), bNode *UNUSED( } /* node type definition */ -void register_node_type_sh_layer_weight(ListBase *lb) +void register_node_type_sh_layer_weight(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_layer_weight_in, sh_node_layer_weight_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_layer_weight(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_layer_weight); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c index b64b9bf8b11..5d7a3014682 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -46,11 +46,11 @@ static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *UNUSED(node), GPU } /* node type definition */ -void register_node_type_sh_light_path(ListBase *lb) +void register_node_type_sh_light_path(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_light_path_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_light_path(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_light_path); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c index 2fa885dcdd3..c2a58d49161 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.c +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c @@ -86,11 +86,11 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax); } -void register_node_type_sh_mapping(ListBase *lb) +void register_node_type_sh_mapping(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out); node_type_size(&ntype, 240, 160, 320); @@ -99,5 +99,5 @@ void register_node_type_sh_mapping(ListBase *lb) node_type_exec(&ntype, node_shader_exec_mapping); node_type_gpu(&ntype, gpu_shader_mapping); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index a74a2567844..decd3bb225f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -300,11 +300,11 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 0; } -void register_node_type_sh_material(ListBase *lb) +void register_node_type_sh_material(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); + node_type_base(ttype, &ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_material_in, sh_node_material_out); node_type_size(&ntype, 120, 80, 240); @@ -312,15 +312,15 @@ void register_node_type_sh_material(ListBase *lb) node_type_exec(&ntype, node_shader_exec_material); node_type_gpu(&ntype, gpu_shader_material); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } -void register_node_type_sh_material_ext(ListBase *lb) +void register_node_type_sh_material_ext(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); + node_type_base(ttype, &ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_material_ext_in, sh_node_material_ext_out); node_type_size(&ntype, 120, 80, 240); @@ -328,7 +328,5 @@ void register_node_type_sh_material_ext(ListBase *lb) node_type_exec(&ntype, node_shader_exec_material); node_type_gpu(&ntype, gpu_shader_material); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index 1c15c49a7da..c9234c626aa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -236,11 +236,11 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN return 1; } -void register_node_type_sh_math(ListBase *lb) +void register_node_type_sh_math(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out); node_type_size(&ntype, 120, 110, 160); @@ -249,7 +249,5 @@ void register_node_type_sh_math(ListBase *lb) node_type_exec(&ntype, node_shader_exec_math); node_type_gpu(&ntype, gpu_shader_math); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c index 5d7ec9a23ab..e7350612b5b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c @@ -73,11 +73,11 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G } -void register_node_type_sh_mix_rgb(ListBase *lb) +void register_node_type_sh_mix_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); node_type_size(&ntype, 100, 60, 150); @@ -85,6 +85,5 @@ void register_node_type_sh_mix_rgb(ListBase *lb) node_type_exec(&ntype, node_shader_exec_mix_rgb); node_type_gpu(&ntype, gpu_shader_mix_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c index bf44d26024c..43dde9e5b91 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c @@ -47,11 +47,11 @@ static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *UNUSED(node), GPU } /* node type definition */ -void register_node_type_sh_mix_shader(ListBase *lb) +void register_node_type_sh_mix_shader(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mix_shader_in, sh_node_mix_shader_out); node_type_size(&ntype, 150, 60, 200); @@ -60,6 +60,5 @@ void register_node_type_sh_mix_shader(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_mix_shader); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c index 40f2f65a193..f699268e939 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal.c @@ -79,16 +79,16 @@ static int gpu_shader_normal(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GP return GPU_stack_link(mat, "normal", in, out, vec); } -void register_node_type_sh_normal(ListBase *lb) +void register_node_type_sh_normal(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out); node_type_init(&ntype, node_shader_init_normal); node_type_exec(&ntype, node_shader_exec_normal); node_type_gpu(&ntype, gpu_shader_normal); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c index 22e3cab532d..8be634367a5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ b/source/blender/nodes/shader/nodes/node_shader_output.c @@ -78,18 +78,16 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return 1; } -void register_node_type_sh_output(ListBase *lb) +void register_node_type_sh_output(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_base(ttype, &ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_output_in, NULL); node_type_size(&ntype, 80, 60, 200); node_type_exec(&ntype, node_shader_exec_output); node_type_gpu(&ntype, gpu_shader_output); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c index 8aa9de15eb4..3fe4862e8c8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c @@ -35,11 +35,11 @@ static bNodeSocketTemplate sh_node_output_lamp_in[]= { }; /* node type definition */ -void register_node_type_sh_output_lamp(ListBase *lb) +void register_node_type_sh_output_lamp(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_OUTPUT_LAMP, "Lamp Output", NODE_CLASS_OUTPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_OUTPUT_LAMP, "Lamp Output", NODE_CLASS_OUTPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_lamp_in, NULL); node_type_size(&ntype, 120, 60, 200); @@ -48,6 +48,5 @@ void register_node_type_sh_output_lamp(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index 58d8bc03972..15a201f9f21 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -48,11 +48,11 @@ static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *UNUSED(node) /* node type definition */ -void register_node_type_sh_output_material(ListBase *lb) +void register_node_type_sh_output_material(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_material_in, NULL); node_type_size(&ntype, 120, 60, 200); @@ -61,6 +61,5 @@ void register_node_type_sh_output_material(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_output_material); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c index 98cecd0d04b..6283c28c485 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c @@ -36,11 +36,11 @@ static bNodeSocketTemplate sh_node_output_world_in[]= { }; /* node type definition */ -void register_node_type_sh_output_world(ListBase *lb) +void register_node_type_sh_output_world(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_world_in, NULL); node_type_size(&ntype, 120, 60, 200); @@ -49,6 +49,5 @@ void register_node_type_sh_output_world(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c index 58a00ed92e5..d0c52035f96 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c @@ -66,11 +66,11 @@ static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNo return GPU_stack_link(mat, "set_rgba", in, out, vec); } -void register_node_type_sh_rgb(ListBase *lb) +void register_node_type_sh_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_rgb_out); node_type_init(&ntype, node_shader_init_rgb); @@ -78,6 +78,5 @@ void register_node_type_sh_rgb(ListBase *lb) node_type_exec(&ntype, node_shader_exec_rgb); node_type_gpu(&ntype, gpu_shader_rgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c index 4f409bb3ec1..09371a8a5ae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c @@ -56,18 +56,18 @@ static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "separate_rgb", in, out); } -void register_node_type_sh_seprgb(ListBase *lb) +void register_node_type_sh_seprgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_shader_exec_seprgb); node_type_gpu(&ntype, gpu_shader_seprgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -96,17 +96,16 @@ static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "combine_rgb", in, out); } -void register_node_type_sh_combrgb(ListBase *lb) +void register_node_type_sh_combrgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out); node_type_size(&ntype, 80, 40, 140); node_type_exec(&ntype, node_shader_exec_combrgb); node_type_gpu(&ntype, gpu_shader_combrgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c index 16a9ae8aedc..ded930659e5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.c +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c @@ -62,11 +62,11 @@ static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "squeeze", in, out); } -void register_node_type_sh_squeeze(ListBase *lb) +void register_node_type_sh_squeeze(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out); node_type_size(&ntype, 120, 110, 160); @@ -74,7 +74,5 @@ void register_node_type_sh_squeeze(ListBase *lb) node_type_exec(&ntype, node_shader_exec_squeeze); node_type_gpu(&ntype, gpu_shader_squeeze); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index 0982c0fe90d..8f67fb585c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -52,11 +52,11 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), GPUN } /* node type definition */ -void register_node_type_sh_tex_coord(ListBase *lb) +void register_node_type_sh_tex_coord(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); + node_type_base(ttype, &ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_tex_coord_out); node_type_size(&ntype, 150, 60, 200); @@ -65,6 +65,5 @@ void register_node_type_sh_tex_coord(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_coord); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index 5639e82ddb8..dbdd6a8619b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -69,11 +69,11 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod } /* node type definition */ -void register_node_type_sh_tex_environment(ListBase *lb) +void register_node_type_sh_tex_environment(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_environment_in, sh_node_tex_environment_out); node_type_size(&ntype, 150, 60, 200); @@ -82,6 +82,5 @@ void register_node_type_sh_tex_environment(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_environment); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index f93507e2997..a2403b6bdec 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -61,11 +61,11 @@ static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeSt } /* node type definition */ -void register_node_type_sh_tex_gradient(ListBase *lb) +void register_node_type_sh_tex_gradient(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_gradient_in, sh_node_tex_gradient_out); node_type_size(&ntype, 150, 60, 200); @@ -74,6 +74,5 @@ void register_node_type_sh_tex_gradient(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_gradient); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index ce614d6117d..aa679b4e04e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -69,11 +69,11 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack } /* node type definition */ -void register_node_type_sh_tex_image(ListBase *lb) +void register_node_type_sh_tex_image(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_image_in, sh_node_tex_image_out); node_type_size(&ntype, 150, 60, 200); @@ -82,6 +82,5 @@ void register_node_type_sh_tex_image(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_image); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index 73a66c94193..3a270220667 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -66,11 +66,11 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack } /* node type definition */ -void register_node_type_sh_tex_magic(ListBase *lb) +void register_node_type_sh_tex_magic(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_magic_in, sh_node_tex_magic_out); node_type_size(&ntype, 150, 60, 200); @@ -79,6 +79,5 @@ void register_node_type_sh_tex_magic(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_magic); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 00cde10ccea..015b78687fd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -67,11 +67,11 @@ static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeSt } /* node type definition */ -void register_node_type_sh_tex_musgrave(ListBase *lb) +void register_node_type_sh_tex_musgrave(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_musgrave_in, sh_node_tex_musgrave_out); node_type_size(&ntype, 150, 60, 200); @@ -80,6 +80,5 @@ void register_node_type_sh_tex_musgrave(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_musgrave); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c index f767fb6f36d..bb365cf5a33 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -63,11 +63,11 @@ static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack } /* node type definition */ -void register_node_type_sh_tex_noise(ListBase *lb) +void register_node_type_sh_tex_noise(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(ttype, &ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_noise_in, sh_node_tex_noise_out); node_type_size(&ntype, 150, 60, 200); @@ -76,6 +76,5 @@ void register_node_type_sh_tex_noise(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_noise); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 72bcccee5c7..a4131f3ca6c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -63,11 +63,11 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack * } /* node type definition */ -void register_node_type_sh_tex_sky(ListBase *lb) +void register_node_type_sh_tex_sky(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); node_type_size(&ntype, 150, 60, 200); @@ -76,6 +76,5 @@ void register_node_type_sh_tex_sky(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_sky); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index 563774d8338..9adaab22b03 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -62,11 +62,11 @@ static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeSta } /* node type definition */ -void register_node_type_sh_tex_voronoi(ListBase *lb) +void register_node_type_sh_tex_voronoi(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_voronoi_in, sh_node_tex_voronoi_out); node_type_size(&ntype, 150, 60, 200); @@ -75,6 +75,5 @@ void register_node_type_sh_tex_voronoi(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_voronoi); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index 059a41c2b0c..d359a407bc0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -65,11 +65,11 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack } /* node type definition */ -void register_node_type_sh_tex_wave(ListBase *lb) +void register_node_type_sh_tex_wave(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_wave_in, sh_node_tex_wave_out); node_type_size(&ntype, 150, 60, 200); @@ -78,6 +78,5 @@ void register_node_type_sh_tex_wave(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_tex_wave); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c index c26cf2451df..02818496dab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_texture.c +++ b/source/blender/nodes/shader/nodes/node_shader_texture.c @@ -133,18 +133,16 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return 0; } -void register_node_type_sh_texture(ListBase *lb) +void register_node_type_sh_texture(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); + node_type_base(ttype, &ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_texture_in, sh_node_texture_out); node_type_size(&ntype, 120, 80, 240); node_type_exec(&ntype, node_shader_exec_texture); node_type_gpu(&ntype, gpu_shader_texture); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 94afd09274a..f0a94928985 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -71,11 +71,11 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array)); } -void register_node_type_sh_valtorgb(ListBase *lb) +void register_node_type_sh_valtorgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out); node_type_size(&ntype, 240, 200, 300); @@ -84,7 +84,7 @@ void register_node_type_sh_valtorgb(ListBase *lb) node_type_exec(&ntype, node_shader_exec_valtorgb); node_type_gpu(&ntype, gpu_shader_valtorgb); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -112,18 +112,16 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "rgbtobw", in, out); } -void register_node_type_sh_rgbtobw(ListBase *lb) +void register_node_type_sh_rgbtobw(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, node_shader_exec_rgbtobw); node_type_gpu(&ntype, gpu_shader_rgbtobw); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c index 8f490f4953b..3196ce5cbe4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.c +++ b/source/blender/nodes/shader/nodes/node_shader_value.c @@ -66,11 +66,11 @@ static int gpu_shader_value(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU return GPU_stack_link(mat, "set_value", in, out, vec); } -void register_node_type_sh_value(ListBase *lb) +void register_node_type_sh_value(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_value_out); node_type_init(&ntype, node_shader_init_value); @@ -78,7 +78,5 @@ void register_node_type_sh_value(ListBase *lb) node_type_exec(&ntype, node_shader_exec_value); node_type_gpu(&ntype, gpu_shader_value); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index bb56037b4d4..75dbff11b6e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -130,11 +130,11 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 1; } -void register_node_type_sh_vect_math(ListBase *lb) +void register_node_type_sh_vect_math(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out); node_type_size(&ntype, 80, 75, 140); @@ -143,7 +143,5 @@ void register_node_type_sh_vect_math(ListBase *lb) node_type_exec(&ntype, node_shader_exec_vect_math); node_type_gpu(&ntype, gpu_shader_vect_math); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - - diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c index 1ce975eae8f..6eb3178709f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c @@ -46,11 +46,11 @@ static int node_shader_gpu_volume_isotropic(GPUMaterial *UNUSED(mat), bNode *UNU } /* node type definition */ -void register_node_type_sh_volume_isotropic(ListBase *lb) +void register_node_type_sh_volume_isotropic(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_VOLUME_ISOTROPIC, "Isotropic Volume", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_VOLUME_ISOTROPIC, "Isotropic Volume", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_volume_isotropic_in, sh_node_volume_isotropic_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_volume_isotropic(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_volume_isotropic); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c index 5c557aee45d..3d2d4fc689e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_transparent.c @@ -46,11 +46,11 @@ static int node_shader_gpu_volume_transparent(GPUMaterial *UNUSED(mat), bNode *U } /* node type definition */ -void register_node_type_sh_volume_transparent(ListBase *lb) +void register_node_type_sh_volume_transparent(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_VOLUME_TRANSPARENT, "Transparent Volume", NODE_CLASS_SHADER, 0); + node_type_base(ttype, &ntype, SH_NODE_VOLUME_TRANSPARENT, "Transparent Volume", NODE_CLASS_SHADER, 0); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_volume_transparent_in, sh_node_volume_transparent_out); node_type_size(&ntype, 150, 60, 200); @@ -59,6 +59,5 @@ void register_node_type_sh_volume_transparent(ListBase *lb) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_volume_transparent); - nodeRegisterType(lb, &ntype); -}; - + nodeRegisterType(ttype, &ntype); +} diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index 65787891602..33548be3208 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -58,14 +58,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_at(ListBase *lb) +void register_node_type_tex_at(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0); + node_type_base(ttype, &ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index 0700085a787..b4b25a10537 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -119,15 +119,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_bricks(ListBase *lb) +void register_node_type_tex_bricks(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 150, 60, 150); node_type_init(&ntype, init); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index aebd3f2a05c..6b5848270ba 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -69,14 +69,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_checker(ListBase *lb) +void register_node_type_tex_checker(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index 0b8ee031d4f..9a66ecb5ffb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -125,11 +125,11 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node ntreeReleaseThreadStack(nts); } -void register_node_type_tex_group(ListBase *lb) +void register_node_type_tex_group(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); + node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -140,7 +140,7 @@ void register_node_type_tex_group(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } @@ -186,11 +186,11 @@ static void forloop_execute(void *data, int thread, struct bNode *node, void *no ntreeReleaseThreadStack(nts); } -void register_node_type_tex_forloop(ListBase *lb) +void register_node_type_tex_forloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -202,7 +202,7 @@ void register_node_type_tex_forloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif @@ -248,11 +248,11 @@ static void whileloop_execute(void *data, int thread, struct bNode *node, void * ntreeReleaseThreadStack(nts); } -void register_node_type_tex_whileloop(ListBase *lb) +void register_node_type_tex_whileloop(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); + node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 120, 60, 200); node_type_label(&ntype, node_group_label); @@ -264,6 +264,6 @@ void register_node_type_tex_whileloop(ListBase *lb) node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear); node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } #endif diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index d2a6cd0cb42..5256db98d78 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -57,14 +57,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_compose(ListBase *lb) +void register_node_type_tex_compose(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0); + node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index a86324e9f7d..6d6f31d6aaa 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -50,15 +50,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &vectorfn, data); } -void register_node_type_tex_coord(ListBase *lb) +void register_node_type_tex_coord(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, outputs); node_type_size(&ntype, 120, 110, 160); node_type_storage(&ntype, "node_coord", NULL, NULL); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index b14036ace5b..08e7efc1606 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -66,18 +66,18 @@ static void time_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUS node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_tex_curve_time(ListBase *lb) +void register_node_type_tex_curve_time(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, time_outputs); node_type_size(&ntype, 140, 100, 320); node_type_init(&ntype, time_init); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, time_exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } /* **************** CURVE RGB ******************** */ @@ -110,17 +110,16 @@ static void rgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSE node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); } -void register_node_type_tex_curve_rgb(ListBase *lb) +void register_node_type_tex_curve_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs); node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, rgb_init); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); node_type_exec(&ntype, rgb_exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index e83e6a718ef..435b87164c4 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -78,14 +78,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[3], &valuefn_a, data); } -void register_node_type_tex_decompose(ListBase *lb) +void register_node_type_tex_decompose(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0); + node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index c0a9950e761..a2c1f41c0de 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -61,15 +61,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -void register_node_type_tex_distance(ListBase *lb) +void register_node_type_tex_distance(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 110, 160); node_type_storage(&ntype, "node_distance", NULL, NULL); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index 3346592f7d3..e566fb0298a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -92,14 +92,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_hue_sat(ListBase *lb) +void register_node_type_tex_hue_sat(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 150, 80, 250); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 0ead3a3dec2..0acfe62ed82 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -95,16 +95,16 @@ static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(nt iuser->ok= 1; } -void register_node_type_tex_image(ListBase *lb) +void register_node_type_tex_image(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, outputs); node_type_size(&ntype, 120, 80, 300); node_type_init(&ntype, init); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index 5ee60d02e32..297675f498c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -63,15 +63,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_invert(ListBase *lb) +void register_node_type_tex_invert(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 74b9dcdd30a..4659aa2b6c0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -184,17 +184,16 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -void register_node_type_tex_math(ListBase *lb) +void register_node_type_tex_math(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 110, 160); node_type_label(&ntype, node_math_label); node_type_storage(&ntype, "node_math", NULL, NULL); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index e3b5119c797..13816088ea7 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -64,15 +64,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_mix_rgb(ListBase *lb) +void register_node_type_tex_mix_rgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_label(&ntype, node_blend_label); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 42ee2847d06..dc96f5abcb5 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -157,16 +157,16 @@ static void copy(bNode *orig, bNode *new) assign_index(new); } -void register_node_type_tex_output(ListBase *lb) +void register_node_type_tex_output(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, NULL); node_type_size(&ntype, 150, 60, 200); node_type_init(&ntype, init); node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index 3012d313db5..fac8b02fb85 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -296,18 +296,18 @@ static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(nt /* Node type definitions */ #define TexDef(TEXTYPE, outputs, name, Name) \ -void register_node_type_tex_proc_##name(ListBase *lb) \ +void register_node_type_tex_proc_##name(bNodeTreeType *ttype) \ { \ static bNodeType ntype; \ \ - node_type_base(&ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \ + node_type_base(ttype, &ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \ node_type_socket_templates(&ntype, name##_inputs, outputs); \ node_type_size(&ntype, 140, 80, 140); \ node_type_init(&ntype, init); \ node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \ node_type_exec(&ntype, name##_exec); \ \ - nodeRegisterType(lb, &ntype); \ + nodeRegisterType(ttype, &ntype); \ } #define C outputs_color_only diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index a3f69286269..d1c9cca3f3c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -95,14 +95,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_rotate(ListBase *lb) +void register_node_type_tex_rotate(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index f42b3addc91..f8790d414c9 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -68,14 +68,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_scale(ListBase *lb) +void register_node_type_tex_scale(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 667570582fe..3a0f11d5417 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -95,14 +95,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_texture(ListBase *lb) +void register_node_type_tex_texture(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 120, 80, 240); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index 8d09b4363f8..61b0702b333 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -64,14 +64,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -void register_node_type_tex_translate(ListBase *lb) +void register_node_type_tex_translate(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index 28b0a19c5a9..c8159060433 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -80,14 +80,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &normalfn, data); } -void register_node_type_tex_valtonor(ListBase *lb) +void register_node_type_tex_valtonor(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 90, 80, 100); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 0a6cdbd2024..c0efa43c14f 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -62,18 +62,18 @@ static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate * node->storage = add_colorband(1); } -void register_node_type_tex_valtorgb(ListBase *lb) +void register_node_type_tex_valtorgb(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); + node_type_base(ttype, &ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS); node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out); node_type_size(&ntype, 240, 200, 300); node_type_init(&ntype, valtorgb_init); node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, valtorgb_exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } /* **************** RGBTOBW ******************** */ @@ -100,15 +100,14 @@ static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack ** tex_output(node, in, out[0], &rgbtobw_valuefn, data); } -void register_node_type_tex_rgbtobw(ListBase *lb) +void register_node_type_tex_rgbtobw(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); + node_type_base(ttype, &ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out); node_type_size(&ntype, 80, 40, 120); node_type_exec(&ntype, rgbtobw_exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } - diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index a9670bfa78b..4b4a9fdb4eb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -56,14 +56,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o } } -void register_node_type_tex_viewer(ListBase *lb) +void register_node_type_tex_viewer(bNodeTreeType *ttype) { static bNodeType ntype; - node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_base(ttype, &ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, exec); - nodeRegisterType(lb, &ntype); + nodeRegisterType(ttype, &ntype); } From 45486735e33248315e911a19cc62e997e3e943f9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 16:21:49 +0000 Subject: [PATCH 198/203] Fix compilation error with oceansim disabled --- source/blender/blenkernel/intern/ocean.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 5cf0b8c2348..85b9b0fbf22 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1404,15 +1404,16 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *UNUSED(och), struct OceanResult { } -struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale), - float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution)) +struct OceanCache *BKE_init_ocean_cache(const char *UNUSED(bakepath), const char *UNUSED(relbase), + int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale), + float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution)) { OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data"); return och; } -void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), const char *UNUSED(relbase), int UNUSED(frame)) +void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), int UNUSED(frame)) { } From f8431e459f15b51d3f14f2228e8589c76c723f9b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 16:26:37 +0000 Subject: [PATCH 199/203] Fix #29295: Problem with Alpha Channel video in Sequencer and textures Bug was caused by workaround for old versions of FFmpeg which aren't supported anymore due to pts stuff. Removing workarounds for alpha channels. --- source/blender/imbuf/intern/anim_movie.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 642b84f4897..8928774dcb4 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -658,10 +658,6 @@ static void ffmpeg_postprocess(struct anim * anim) dst2, dstStride2); - /* workaround: sws_scale bug - sets alpha = 0 and compensate - for altivec-bugs and flipy... */ - bottom = (unsigned char*) ibuf->rect; top = bottom + ibuf->x * (ibuf->y-1) * 4; @@ -672,17 +668,17 @@ static void ffmpeg_postprocess(struct anim * anim) unsigned char tmp[4]; unsigned int * tmp_l = (unsigned int*) tmp; - tmp[3] = 0xff; for (x = 0; x < w; x++) { tmp[0] = bottom[0]; tmp[1] = bottom[1]; tmp[2] = bottom[2]; + tmp[3] = bottom[3]; bottom[0] = top[0]; bottom[1] = top[1]; bottom[2] = top[2]; - bottom[3] = 0xff; + bottom[3] = top[3]; *(unsigned int*) top = *tmp_l; @@ -698,7 +694,6 @@ static void ffmpeg_postprocess(struct anim * anim) uint8_t* dst2[4] = { dst[0] + (anim->y - 1)*dstStride[0], 0, 0, 0 }; int i; - unsigned char* r; sws_scale(anim->img_convert_ctx, (const uint8_t * const *)input->data, @@ -707,17 +702,6 @@ static void ffmpeg_postprocess(struct anim * anim) anim->pCodecCtx->height, dst2, dstStride2); - - r = (unsigned char*) ibuf->rect; - - /* workaround sws_scale bug: older version of - sws_scale set alpha = 0... */ - if (r[3] == 0) { - for (i = 0; i < ibuf->x * ibuf->y; i++) { - r[3] = 0xff; - r += 4; - } - } } if (filter_y) { From bbf8315313a9e221ba398bbe06e342bd949c973b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 16:26:42 +0000 Subject: [PATCH 200/203] Tag unused variable in recent nodes commit. --- source/blender/blenkernel/intern/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 904e0d187f8..31e032b7511 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1643,7 +1643,7 @@ struct bNodeTemplate nodeMakeTemplate(struct bNode *node) } } -void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char *name, short nclass, short flag) +void node_type_base(bNodeTreeType *UNUSED(ttype), bNodeType *ntype, int type, const char *name, short nclass, short flag) { memset(ntype, 0, sizeof(bNodeType)); From 6673c76e78742c64ccd0afa7a9d1f598a8022878 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 20 Nov 2011 16:38:23 +0000 Subject: [PATCH 201/203] Muting node patch: second part. Also fix [#27636] Muting shading nodes is ignored MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now, compositing, shading and texture nodes have a consistent muting system, with default behaving as previous (for compo), and which can be optionaly customized by each node. Shader nodes are also GLSL muted. However, Cycles is currently unaware of muted nodes, will try to address this… --- source/blender/blenkernel/BKE_node.h | 41 +- source/blender/blenkernel/intern/node.c | 29 +- source/blender/editors/space_node/node_draw.c | 49 +- source/blender/editors/space_node/node_edit.c | 3 +- source/blender/gpu/CMakeLists.txt | 2 + source/blender/gpu/GPU_material.h | 2 + source/blender/gpu/SConscript | 2 +- source/blender/gpu/intern/gpu_codegen.c | 27 ++ .../gpu/intern/gpu_shader_material.glsl | 20 + .../gpu/intern/gpu_shader_material.glsl.c | 458 +++++++++--------- .../nodes/composite/node_composite_tree.c | 15 +- .../nodes/composite/node_composite_util.c | 55 +-- .../nodes/composite/node_composite_util.h | 2 +- .../nodes/node_composite_composite.c | 2 + .../nodes/node_composite_splitViewer.c | 2 + .../composite/nodes/node_composite_viewer.c | 2 + source/blender/nodes/intern/node_exec.c | 16 +- source/blender/nodes/intern/node_util.c | 61 +++ source/blender/nodes/intern/node_util.h | 11 + .../blender/nodes/shader/node_shader_tree.c | 6 +- .../blender/nodes/shader/node_shader_util.c | 63 ++- .../blender/nodes/shader/node_shader_util.h | 3 + .../nodes/shader/nodes/node_shader_output.c | 4 + .../shader/nodes/node_shader_output_lamp.c | 4 + .../nodes/node_shader_output_material.c | 4 + .../shader/nodes/node_shader_output_world.c | 4 + .../blender/nodes/texture/node_texture_tree.c | 6 +- .../blender/nodes/texture/node_texture_util.c | 92 ++++ .../blender/nodes/texture/node_texture_util.h | 2 + .../nodes/texture/nodes/node_texture_output.c | 3 + .../nodes/texture/nodes/node_texture_viewer.c | 3 + 31 files changed, 687 insertions(+), 306 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 32e858bdcb6..82e42ae27e2 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -190,10 +190,24 @@ typedef struct bNodeType { * when a final generic version of execution code is defined, this will be changed anyway */ void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **); + /* This is the muting callback. + * XXX Mimics the newexecfunc signature... Not sure all of this will be useful, we will see. + */ + void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **); + /* And the muting util. + * Returns links as a ListBase, as pairs of bNodeStack* if in/out bNodeStacks were provided, + * else as pairs of bNodeSocket* if node tree was provided. + */ + ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **, + struct GPUNodeStack *, struct GPUNodeStack *); /* gpu */ int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out); /* extended gpu function */ int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out); + /* This is the muting gpu callback. + * XXX Mimics the gpuextfunc signature... Not sure all of this will be useful, we will see. + */ + int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *); } bNodeType; /* node->exec, now in use for composites (#define for break is same as ready yes) */ @@ -270,6 +284,13 @@ typedef struct bNodeTreeType void (*update_node)(struct bNodeTree *ntree, struct bNode *node); int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); + + /* Default muting pointers. */ + void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **); + ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **, + struct GPUNodeStack *, struct GPUNodeStack *); + /* gpu */ + int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *); } bNodeTreeType; /* ************** GENERIC API, TREES *************** */ @@ -391,13 +412,25 @@ void node_type_group_edit(struct bNodeType *ntype, struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit), void (*group_edit_clear)(struct bNode *node)); -void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **)); +void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, + struct bNodeStack **)); void node_type_exec_new(struct bNodeType *ntype, void *(*initexecfunc)(struct bNode *node), void (*freeexecfunc)(struct bNode *node, void *nodedata), - void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **)); -void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)); -void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out)); + void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, + struct bNodeStack **, struct bNodeStack **)); +void node_type_mute(struct bNodeType *ntype, + void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, + struct bNodeStack **, struct bNodeStack **), + ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, + struct bNodeStack **, struct GPUNodeStack*, struct GPUNodeStack*)); +void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, + struct GPUNodeStack *in, struct GPUNodeStack *out)); +void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, + void *nodedata, struct GPUNodeStack *in, + struct GPUNodeStack *out)); +void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, + struct GPUNodeStack *, struct GPUNodeStack *)); void node_type_compatibility(struct bNodeType *ntype, short compatibility); /* ************** COMMON NODES *************** */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 31e032b7511..7be6ef9968d 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1643,15 +1643,22 @@ struct bNodeTemplate nodeMakeTemplate(struct bNode *node) } } -void node_type_base(bNodeTreeType *UNUSED(ttype), bNodeType *ntype, int type, const char *name, short nclass, short flag) +void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char *name, short nclass, short flag) { memset(ntype, 0, sizeof(bNodeType)); - + ntype->type = type; BLI_strncpy(ntype->name, name, sizeof(ntype->name)); ntype->nclass = nclass; ntype->flag = flag; - + + /* Default muting stuff. */ + if(ttype) { + ntype->mutefunc = ttype->mutefunc; + ntype->mutelinksfunc = ttype->mutelinksfunc; + ntype->gpumutefunc = ttype->gpumutefunc; + } + /* default size values */ ntype->width = 140; ntype->minwidth = 100; @@ -1746,6 +1753,16 @@ void node_type_exec_new(struct bNodeType *ntype, ntype->newexecfunc = newexecfunc; } +void node_type_mute(struct bNodeType *ntype, + void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, + struct bNodeStack **, struct bNodeStack **), + ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **, + struct GPUNodeStack *, struct GPUNodeStack *)) +{ + ntype->mutefunc = mutefunc; + ntype->mutelinksfunc = mutelinksfunc; +} + void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)) { ntype->gpufunc = gpufunc; @@ -1756,6 +1773,12 @@ void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMate ntype->gpuextfunc = gpuextfunc; } +void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, + struct GPUNodeStack *, struct GPUNodeStack *)) +{ + ntype->gpumutefunc = gpumutefunc; +} + void node_type_compatibility(struct bNodeType *ntype, short compatibility) { ntype->compatibility = compatibility; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 36cba15e5f2..c4a7f2cb473 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -73,6 +73,8 @@ #include "NOD_composite.h" #include "NOD_shader.h" +#include "intern/node_util.h" + #include "node_intern.h" /* width of socket columns in group display */ @@ -418,38 +420,41 @@ static int node_get_colorid(bNode *node) return TH_NODE; } -/* note: in cmp_util.c is similar code, for node_compo_pass_on() */ +/* note: in cmp_util.c is similar code, for node_compo_pass_on() + * the same goes for shader and texture nodes. */ /* note: in node_edit.c is similar code, for untangle node */ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) { - static int types[]= { SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA }; + ListBase links; + LinkInOutsMuteNode *lnk; bNodeLink link= {NULL}; int i; - - /* connect the first input of each type with first output of the same type */ - + + if(node->typeinfo->mutelinksfunc == NULL) + return; + + /* Get default muting links (as bNodeSocket pointers). */ + links = node->typeinfo->mutelinksfunc(snode->edittree, node, NULL, NULL, NULL, NULL); + glEnable(GL_BLEND); - glEnable( GL_LINE_SMOOTH ); - + glEnable(GL_LINE_SMOOTH); + link.fromnode = link.tonode = node; - for (i=0; i < 3; ++i) { - /* find input socket */ - for (link.fromsock=node->inputs.first; link.fromsock; link.fromsock=link.fromsock->next) - if (link.fromsock->type==types[i] && nodeCountSocketLinks(snode->edittree, link.fromsock)) - break; - if (link.fromsock) { - for (link.tosock=node->outputs.first; link.tosock; link.tosock=link.tosock->next) - if (link.tosock->type==types[i] && nodeCountSocketLinks(snode->edittree, link.tosock)) - break; - - if (link.tosock) { - node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); - } + for(lnk = links.first; lnk; lnk = lnk->next) { + for(i = 0; i < lnk->num_outs; i++) { + link.fromsock = (bNodeSocket*)(lnk->in); + link.tosock = (bNodeSocket*)(lnk->outs)+i; + node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE); } + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(i > 1) + MEM_freeN(lnk->outs); } - + glDisable(GL_BLEND); - glDisable( GL_LINE_SMOOTH ); + glDisable(GL_LINE_SMOOTH); + + BLI_freelistN(&links); } /* this might have some more generic use */ diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 23855ff24e1..cd4e99900e7 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3283,7 +3283,8 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) ED_preview_kill_jobs(C); for(node= snode->edittree->nodes.first; node; node= node->next) { - if(node->flag & SELECT) { + /* Only allow muting of nodes having a mute func! */ + if((node->flag & SELECT) && node->typeinfo->mutefunc) { /* Be able to mute in-/output nodes as well. - DingTo if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 557b22e3a2e..4488442815d 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -31,6 +31,8 @@ set(INC ../imbuf ../makesdna ../makesrna + ../nodes # For node muting stuff... + ../nodes/intern # For node muting stuff... ../../../intern/guardedalloc ../../../intern/smoke/extern ) diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 00c47a2501f..e838d801dc1 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -49,6 +49,7 @@ struct Lamp; struct Image; struct bNode; struct LinkNode; +struct LinkInOutsMuteNode; struct Scene; struct GPUVertexAttribs; struct GPUNode; @@ -117,6 +118,7 @@ GPUNodeLink *GPU_builtin(GPUBuiltin builtin); int GPU_link(GPUMaterial *mat, const char *name, ...); int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...); +int GPU_stack_link_mute(GPUMaterial *mat, const char *name, struct LinkInOutsMuteNode *mlnk); void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link); void GPU_material_enable_alpha(GPUMaterial *material); diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript index adb52d577a1..ee4491c1c77 100644 --- a/source/blender/gpu/SConscript +++ b/source/blender/gpu/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c') defs = [ 'GLEW_STATIC' ] -incs = '../blenlib ../blenkernel ../makesdna ../makesrna ../include ../blenloader' +incs = '../blenlib ../blenkernel ../makesdna ../makesrna ../include ../blenloader ../nodes ../nodes/intern' incs += ' #/extern/glew/include #intern/guardedalloc #intern/smoke/extern ../imbuf .' if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 35ef48250cc..4a923e66356 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -54,6 +54,8 @@ #include "gpu_codegen.h" +#include "node_util.h" /* For muting node stuff... */ + #include #include @@ -1212,6 +1214,31 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode return 1; } +int GPU_stack_link_mute(GPUMaterial *mat, const char *name, LinkInOutsMuteNode *mlnk) +{ + GPUNode *node; + GPUFunction *function; + int i; + + function = GPU_lookup_function(name); + if(!function) { + fprintf(stderr, "GPU failed to find function %s\n", name); + return 0; + } + + for(i = 0; i < mlnk->num_outs; i++) { + node = GPU_node_begin(name); + gpu_node_input_socket(node, (GPUNodeStack*)mlnk->in); + GPU_node_output(node, ((GPUNodeStack*)mlnk->outs+i)->type, ((GPUNodeStack*)mlnk->outs+i)->name, + &((GPUNodeStack*)mlnk->outs+i)->link); + GPU_node_end(node); + + gpu_material_add_node(mat, node); + } + + return 1; +} + int GPU_link_changed(GPUNodeLink *link) { GPUNode *node; diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 5aaf99bdd24..5d2da31ac5f 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -368,6 +368,26 @@ void set_rgba_zero(out vec4 outval) outval = vec4(0.0); } +void copy_raw(vec4 val, out vec4 outval) +{ + outval = val; +} + +void copy_raw(vec3 val, out vec3 outval) +{ + outval = val; +} + +void copy_raw(vec2 val, out vec2 outval) +{ + outval = val; +} + +void copy_raw(float val, out float outval) +{ + outval = val; +} + void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol) { fac = clamp(fac, 0.0, 1.0); diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index 493c32d5a45..0b7bd5d48bf 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,233 +1,241 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 46619; +int datatoc_gpu_shader_material_glsl_size= 46865; char datatoc_gpu_shader_material_glsl[]= { - 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, - 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99, -109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, - 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32, -114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105, -110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, - 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, - 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, - 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, - 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, - 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, - 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, - 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, - 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, - 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, - 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, - 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, -104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95, -114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, - 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, - 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115, -118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32, -123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115, -101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, - 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, - 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, - 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, - 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, - 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, - 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, - 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, - 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101, -108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32, -113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, - 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, - 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, -114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105, -110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, - 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, - 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, - 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10, -125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, - 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114, -110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108, -115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, - 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110, -101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99, -111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110, -101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32, -115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, - 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, - 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, - 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, - 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99, -111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95, -102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116, -111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32, -108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, - 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110, -101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 35,100, -101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, - 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116, -101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, - 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97, -116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, - 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, - 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, - 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, - 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110, -111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99, -111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, - 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, - 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,112,104, 97, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99, -111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108, -111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, - 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97, -116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45, -110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101, -114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116, -114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,118, 99,111,108, 95, 97,108,112, -104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, - 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, - 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32, -102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, - 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, - 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118, -101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, - 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, - 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, - 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, - 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, -100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32, -118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97, + 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101, +114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, + 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118, +101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, + 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, + 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97, +120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40, +114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99, +100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9, +105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, + 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, + 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, + 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97, +120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105, +102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, + 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, + 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, + 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105, +102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99, +111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, + 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, + 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, + 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105, +102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, + 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, + 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111, +114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40, +102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, + 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, + 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, + 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, + 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101, +108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32, +118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, + 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, + 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115, +101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99, +111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32, +115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, + 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, + 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9, +114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, + 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95, +115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, + 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, + 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111, +119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115, +114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32, +111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115, +114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99, +111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95, +102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110, +101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, + 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, + 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111, +108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, + 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108, +105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99, +111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95, +102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, + 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, + 57, 51, 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, + 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, + 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111, +108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46, +120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111, +108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114, +105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, + 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, + 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, + 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118, +101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116, +116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, + 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32, +111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, + 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111, +108, 95, 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, + 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, +111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, + 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111, +114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9, +110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101, +110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, + 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, + 10, 9,118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, + 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, + 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, + 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, + 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, + 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, + 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117, +116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, + 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, + 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, + 97, 98,115, 40, 99,111, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, + 59, 10, 9,111,117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, + 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, + 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98, +116,114, 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117, +116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, + 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102, +108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, + 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, + 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, + 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, + 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101, +110,116, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, +116,104, 95, 97,115,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, + 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108, +115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, + 97, 99,111,115, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, + 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, + 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, + 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97, +110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,111,117,116,118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, +116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, + 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, + 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, + 97,116,104, 95,108,111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, + 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, + 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117, +116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97, 116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, - 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97, -108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, - 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, - 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97, -108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, - 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, - 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108, -111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, - 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111, -117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97, -108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, - 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, - 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, - 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, - 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97, -108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, - 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, - 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, -117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108, -111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, - 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32, -108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, - 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, -111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, -109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111, -117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, - 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, - 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, - 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, -111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105, -102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9, -101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117, -101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, - 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, - 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32, -118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118, -101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, - 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, - 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117, -116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116, -118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, - 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, +116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32, +102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, + 9,111,117,116,118, 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,109, 97,116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, + 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102, +108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117, +116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97, +116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, +116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97, +108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, + 10, 10,118,111,105,100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32, +119,105,100,116,104, 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111, +119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100, +116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, + 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, + 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, + 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, + 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, + 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, + 32, 45, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, + 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, + 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103, +101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, +118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, + 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116, +118,101, 99, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, - 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116, -118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, - 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, - 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114, -109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97, -116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116, -118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, - 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9, -111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, - 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, - 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, -116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117, -114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, - 48, 46, 48, 41, 41, 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99, -117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, - 32, 48, 46, 48, 41, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, - 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, - 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111, -117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, - 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97, -116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101, -109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46, -114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120, -116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,114, 44, 32, 48, 46, 48, - 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117, -114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117, -114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, - 41, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118, -101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118, -101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46, 98, 59, 10, 10, 9,105, -102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111, -108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99, -111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40, -102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, - 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, -111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, - 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, - 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117, -116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, - 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105, -100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10, -123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115, -101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, + 32, 48, 44, 32, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, + 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118, +101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, + 32,118, 50, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32, +118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, +116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117, +116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, + 95,109, 97,116,104, 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116,118, 41, 10,123, 10, 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, + 40,118,101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116,110,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111, +114, 32, 61, 32,100,105,114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, + 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, + 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101, +120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, + 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116, +101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, + 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32, +116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, + 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, + 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, + 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101, +115, 95,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108, +101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, +123, 10, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, + 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, + 99,111,108, 46,114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, + 46,103, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101, +120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, + 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116, +117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99, +117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, + 48, 41, 41, 46, 98, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111, +108, 32, 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, + 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, +115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32, +115,101,116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111, +108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95, +114,103, 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, +123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108, +117,101, 95,122,101,114,111, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, +118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, + 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, + 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, + 51, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32, +111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, + 10, 10,118,111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 52, 32,118, 97,108, 44, 32,111,117,116, 32,118,101, + 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118, +111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 51, 32,118, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32, +111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, + 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 50, 32,118, 97,108, 44, 32,111,117,116, 32,118,101, 99, 50, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111, +112,121, 95,114, 97,119, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 1a1d744fb1b..d6a1c50162b 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -228,7 +228,11 @@ bNodeTreeType ntreeType_Composite = { /* local_sync */ local_sync, /* local_merge */ local_merge, /* update */ update, - /* update_node */ update_node + /* update_node */ update_node, + /* validate_link */ NULL, + /* mutefunc */ node_compo_pass_on, + /* mutelinksfunc */ node_mute_get_links, + /* gpumutefunc */ NULL }; @@ -356,13 +360,8 @@ static void *exec_composite_node(void *nodeexec_v) node_get_stack(node, thd->stack, nsin, nsout); - if((node->flag & NODE_MUTED) && (!node_only_value(node))) { - /* viewers we execute, for feedback to user */ - if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) - node->typeinfo->execfunc(thd->rd, node, nsin, nsout); - else - node_compo_pass_on(node, nsin, nsout); - } + if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc) + node->typeinfo->mutefunc(thd->rd, 0, node, nodeexec->data, nsin, nsout); else if(node->typeinfo->execfunc) node->typeinfo->execfunc(thd->rd, node, nsin, nsout); else if (node->typeinfo->newexecfunc) diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index ddd55790436..99a36691b10 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -131,44 +131,29 @@ void compbuf_set_node(CompBuf *cbuf, bNode *node) } /* used for disabling node (similar code in node_draw.c for disable line and node_edit for untangling nodes) */ -void node_compo_pass_on(bNode *node, bNodeStack **nsin, bNodeStack **nsout) +void node_compo_pass_on(void *UNUSED(data), int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata), + struct bNodeStack **in, struct bNodeStack **out) { - CompBuf *valbuf= NULL, *colbuf= NULL, *vecbuf= NULL; - bNodeSocket *sock; - int a; - - /* connect the first value buffer in with first value out */ - /* connect the first RGBA buffer in with first RGBA out */ - - /* test the inputs */ - for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) { - if(nsin[a]->data) { - CompBuf *cbuf= nsin[a]->data; - if(cbuf->type==1 && valbuf==NULL) valbuf= cbuf; - if(cbuf->type==3 && vecbuf==NULL) vecbuf= cbuf; - if(cbuf->type==4 && colbuf==NULL) colbuf= cbuf; - } - } - - /* outputs */ - if(valbuf || colbuf || vecbuf) { - for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) { - if(nsout[a]->hasoutput) { - if(sock->type==SOCK_FLOAT && valbuf) { - nsout[a]->data= pass_on_compbuf(valbuf); - valbuf= NULL; - } - if(sock->type==SOCK_VECTOR && vecbuf) { - nsout[a]->data= pass_on_compbuf(vecbuf); - vecbuf= NULL; - } - if(sock->type==SOCK_RGBA && colbuf) { - nsout[a]->data= pass_on_compbuf(colbuf); - colbuf= NULL; - } - } + ListBase links; + LinkInOutsMuteNode *lnk; + int i; + + if(node->typeinfo->mutelinksfunc == NULL) + return; + + /* Get default muting links (as bNodeStack pointers). */ + links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL); + + for(lnk = links.first; lnk; lnk = lnk->next) { + for(i = 0; i < lnk->num_outs; i++) { + if(((bNodeStack*)(lnk->in))->data) + (((bNodeStack*)(lnk->outs))+i)->data = pass_on_compbuf((CompBuf*)((bNodeStack*)(lnk->in))->data); } + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(i > 1) + MEM_freeN(lnk->outs); } + BLI_freelistN(&links); } diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 9cac4c477eb..bb606f4202e 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -124,7 +124,7 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf); void free_compbuf(CompBuf *cbuf); void print_compbuf(char *str, CompBuf *cbuf); void compbuf_set_node(struct CompBuf *cbuf, struct bNode *node); -void node_compo_pass_on(struct bNode *node, struct bNodeStack **nsin, struct bNodeStack **nsout); +void node_compo_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out); CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type); CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy); diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 828dd8fcfc7..a5f90d31643 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -105,6 +105,8 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype) node_type_socket_templates(&ntype, cmp_node_composite_in, NULL); node_type_size(&ntype, 80, 60, 200); node_type_exec(&ntype, node_composit_exec_composite); + /* Do not allow muting for this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index c801c34e8b5..bc8bc7c84d1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -159,6 +159,8 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype) node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_splitviewer); + /* Do not allow muting this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index 46051caced2..6a0c074cdb3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -141,6 +141,8 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype) node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, node_composit_exec_viewer); + /* Do not allow muting this node. */ + node_type_mute(&ntype, NULL, NULL); nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index b6374aeb386..1def0c31983 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -276,7 +276,13 @@ void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread) node = nodeexec->node; if(node->need_exec) { node_get_stack(node, exec->stack, nsin, nsout); - if(node->typeinfo->execfunc) + /* Handle muted nodes... + * If the mute func is not set, assume the node should never be muted, + * and hence execute it! + */ + if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc) + node->typeinfo->mutefunc(callerdata, thread, node, nodeexec->data, nsin, nsout); + else if(node->typeinfo->execfunc) node->typeinfo->execfunc(callerdata, node, nsin, nsout); else if (node->typeinfo->newexecfunc) node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout); @@ -298,7 +304,13 @@ void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call node = nodeexec->node; if(node->need_exec) { node_get_stack(node, nts->stack, nsin, nsout); - if(node->typeinfo->execfunc) + /* Handle muted nodes... + * If the mute func is not set, assume the node should never be muted, + * and hence execute it! + */ + if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc) + node->typeinfo->mutefunc(callerdata, thread, node, nodeexec->data, nsin, nsout); + else if(node->typeinfo->execfunc) node->typeinfo->execfunc(callerdata, node, nsin, nsout); else if (node->typeinfo->newexecfunc) node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout); diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index da85dd0a5ea..dabad10f568 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -97,3 +97,64 @@ const char *node_filter_label(bNode *node) RNA_enum_name(node_filter_items, node->custom1, &name); return name; } + +/* Returns a list of mapping of some input bNodeStack, GPUNodeStack or bNodeSocket + * to one or more outputs of the same type. + * *ntree or (**nsin, **nsout) or (*gnsin, *gnsout) must not be NULL. */ +ListBase node_mute_get_links(bNodeTree *ntree, bNode *node, bNodeStack **nsin, bNodeStack **nsout, + GPUNodeStack *gnsin, GPUNodeStack *gnsout) +{ + static int types[] = { SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA }; + bNodeLink link = {NULL}; + ListBase ret; + LinkInOutsMuteNode *lnk; + int in, out, i; + + ret.first = ret.last = NULL; + + /* Security check! */ + if(!(ntree || (nsin && nsout) || (gnsin && gnsout))) + return ret; + + /* Connect the first input of each type with first output of the same type. */ + + link.fromnode = link.tonode = node; + for (i=0; i < 3; ++i) { + /* find input socket */ + for (in=0, link.fromsock=node->inputs.first; link.fromsock; in++, link.fromsock=link.fromsock->next) { + if (link.fromsock->type==types[i] && (ntree ? nodeCountSocketLinks(ntree, link.fromsock) : nsin ? nsin[in]->hasinput : gnsin[in].hasinput)) + break; + } + if (link.fromsock) { + for (out=0, link.tosock=node->outputs.first; link.tosock; out++, link.tosock=link.tosock->next) { + if (link.tosock->type==types[i] && (ntree ? nodeCountSocketLinks(ntree, link.tosock) : nsout ? nsout[out]->hasoutput : gnsout[out].hasoutput)) + break; + } + if (link.tosock) { + if(nsin && nsout) { + lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link."); + lnk->in = nsin[in]; + lnk->outs = nsout[out]; + lnk->num_outs = 1; + BLI_addtail(&ret, lnk); + } + else if(gnsin && gnsout) { + lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link."); + lnk->in = &gnsin[in]; + lnk->outs = &gnsout[out]; + lnk->num_outs = 1; + BLI_addtail(&ret, lnk); + } + else { + lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link."); + lnk->in = link.fromsock; + lnk->outs = link.tosock; + lnk->num_outs = 1; + BLI_addtail(&ret, lnk); + } + } + } + } + + return ret; +} diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index d127a49cb4b..7ca090394c3 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -41,6 +41,8 @@ #include "NOD_socket.h" +#include "GPU_material.h" /* For Shader muting GPU code... */ + struct bNodeTree; struct bNode; @@ -59,6 +61,15 @@ const char *node_math_label(struct bNode *node); const char *node_vect_math_label(struct bNode *node); const char *node_filter_label(struct bNode *node); +typedef struct LinkInOutsMuteNode +{ + struct LinkInOutsMuteNode *next, *prev; + void *in, *outs; + unsigned int num_outs; /* If > 1, outs is an array of pointers that need to be freed too! */ +} LinkInOutsMuteNode; +ListBase node_mute_get_links(struct bNodeTree *ntree, struct bNode *node, struct bNodeStack **nsin, + struct bNodeStack **nsout, struct GPUNodeStack *gnsin, struct GPUNodeStack *gnsout); + #endif // this is needed for inlining behaviour diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 6c7667c6729..b3144ff6830 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -134,7 +134,11 @@ bNodeTreeType ntreeType_Shader = { /* local_sync */ local_sync, /* local_merge */ NULL, /* update */ update, - /* update_node */ NULL + /* update_node */ NULL, + /* validate_link */ NULL, + /* mute node */ node_shader_pass_on, + /* mute links node */ node_mute_get_links, + /* gpu mute node */ gpu_shader_pass_on }; /* GPU material from shader nodes */ diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index d601c205682..87585c35e6a 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -78,6 +78,54 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns) /* ******************* execute and parse ************ */ +/* Used for muted nodes, just copy the vec data from input to output… */ +void node_shader_pass_on(void *UNUSED(data), int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata), + struct bNodeStack **in, struct bNodeStack **out) +{ + ListBase links; + LinkInOutsMuteNode *lnk; + int i; + + if(node->typeinfo->mutelinksfunc == NULL) + return; + + /* Get default muting links (as bNodeStack pointers). */ + links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL); + + for(lnk = links.first; lnk; lnk = lnk->next) { + for(i = 0; i < lnk->num_outs; i++) { + copy_v4_v4((((bNodeStack*)(lnk->outs))+i)->vec, ((bNodeStack*)(lnk->in))->vec); + } + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(i > 1) + MEM_freeN(lnk->outs); + } + BLI_freelistN(&links); +} + +int gpu_shader_pass_on(struct GPUMaterial *mat, struct bNode *node, void *UNUSED(nodedata), + struct GPUNodeStack *in, struct GPUNodeStack *out) +{ + ListBase links; + LinkInOutsMuteNode *lnk; + + if(node->typeinfo->mutelinksfunc == NULL) + return 0; + + /* Get default muting links (as GPUNodeStack pointers). */ + links = node->typeinfo->mutelinksfunc(NULL, node, NULL, NULL, in, out); + + for(lnk = links.first; lnk; lnk = lnk->next) { + GPU_stack_link_mute(mat, "copy_raw", lnk); + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(lnk->num_outs > 1) + MEM_freeN(lnk->outs); + } + + BLI_freelistN(&links); + return 1; +} + /* go over all used Geometry and Texture nodes, and return a texco flag */ /* no group inside needed, this function is called for groups too */ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mode) @@ -214,7 +262,11 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns) gs->name = ""; gs->hasinput= ns->hasinput && ns->data; - gs->hasoutput= ns->hasoutput && ns->data; + /* XXX Commented out the ns->data check here, as it seems it’s not alwas set, + * even though there *is* a valid connection/output... But that might need + * further investigation. + */ + gs->hasoutput= ns->hasoutput /*&& ns->data*/; gs->sockettype= ns->sockettype; } @@ -293,7 +345,14 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) doit = 1; if (doit) { - if(node->typeinfo->gpufunc) { + if((node->flag & NODE_MUTED) && node->typeinfo->gpumutefunc) { + node_get_stack(node, stack, nsin, nsout); + gpu_stack_from_data_list(gpuin, &node->inputs, nsin); + gpu_stack_from_data_list(gpuout, &node->outputs, nsout); + if(node->typeinfo->gpumutefunc(mat, node, nodeexec->data, gpuin, gpuout)) + data_from_gpu_stack_list(&node->outputs, nsout, gpuout); + } + else if(node->typeinfo->gpufunc) { node_get_stack(node, stack, nsin, nsout); gpu_stack_from_data_list(gpuin, &node->inputs, nsin); gpu_stack_from_data_list(gpuout, &node->outputs, nsout); diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index 48e54d9d0b4..d345f3fb310 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -128,4 +128,7 @@ void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, st void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs); +void node_shader_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out); +int gpu_shader_pass_on(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out); + #endif diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c index 8be634367a5..5bc61859a0a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ b/source/blender/nodes/shader/nodes/node_shader_output.c @@ -89,5 +89,9 @@ void register_node_type_sh_output(bNodeTreeType *ttype) node_type_exec(&ntype, node_shader_exec_output); node_type_gpu(&ntype, gpu_shader_output); + /* Do not allow muting output node. */ + node_type_mute(&ntype, NULL, NULL); + node_type_gpu_mute(&ntype, NULL); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c index 3fe4862e8c8..cf2542c948c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c @@ -48,5 +48,9 @@ void register_node_type_sh_output_lamp(bNodeTreeType *ttype) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); + /* Do not allow muting output node. */ + node_type_mute(&ntype, NULL, NULL); + node_type_gpu_mute(&ntype, NULL); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index 15a201f9f21..298df3bb66f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -61,5 +61,9 @@ void register_node_type_sh_output_material(bNodeTreeType *ttype) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, node_shader_gpu_output_material); + /* Do not allow muting output node. */ + node_type_mute(&ntype, NULL, NULL); + node_type_gpu_mute(&ntype, NULL); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c index 6283c28c485..711f591c192 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c @@ -49,5 +49,9 @@ void register_node_type_sh_output_world(bNodeTreeType *ttype) node_type_exec(&ntype, NULL); node_type_gpu(&ntype, NULL); + /* Do not allow muting output node. */ + node_type_mute(&ntype, NULL, NULL); + node_type_gpu_mute(&ntype, NULL); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index e863e9f6e0f..1e171bd8a46 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -111,7 +111,11 @@ bNodeTreeType ntreeType_Texture = { /* local_sync */ local_sync, /* local_merge */ NULL, /* update */ NULL, - /* update_node */ NULL + /* update_node */ NULL, + /* validate_link */ NULL, + /* mute node */ node_tex_pass_on, + /* mute links node */ node_mute_get_links, + /* gpu mute node */ NULL }; int ntreeTexTagAnimated(bNodeTree *ntree) diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index c3d298d1ecd..06ee4b0a53d 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -143,6 +143,98 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC dg->type = out->sockettype; } +/* Used for muted nodes, just pass the TexDelegate data from input to output… + * XXX That *%!?¿§ callback TextureDelegate system is a nightmare here! + * So I have to use an ugly hack (checking inputs twice!)… Yuk! + * I’d be very happy if someone can imagine a better solution + * (without changing the whole stuff). + * WARNING: These are only suitable for default muting behavior. If you want a custom + * one for your texnode, you must not use them! + */ +static void passonvalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +{ + bNodeSocket *sock; + int i; + + /* test the inputs */ + for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) { + if(sock->link && sock->type==SOCK_FLOAT && in) { + out[0] = tex_input_value(in[i], p, thread); + break; + } + } +} + +static void passonvecfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +{ + bNodeSocket *sock; + int i; + + /* test the inputs */ + for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) { + if(sock->link && sock->type==SOCK_VECTOR && in) { + tex_input_vec(out, in[i], p, thread); + break; + } + } +} + +static void passoncolfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +{ + bNodeSocket *sock; + int i; + + /* test the inputs */ + for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) { + if(sock->link && sock->type==SOCK_RGBA && in) { + tex_input_rgba(out, in[i], p, thread); + break; + } + } +} + +void node_tex_pass_on(void *data, int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata), + struct bNodeStack **in, struct bNodeStack **out) +{ + ListBase links; + LinkInOutsMuteNode *lnk; + int i; + + if(node->typeinfo->mutelinksfunc == NULL) + return; + + /* Get default muting links (as bNodeStack pointers). */ + links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL); + + for(lnk = links.first; lnk; lnk = lnk->next) { + /* XXX This breaks the generality of the system. + * Again, unfortunately, I see no other way to do due to tex nodes behavior... + */ + void (*passonfn)(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread); + switch(((bNodeStack*)(lnk->in))->sockettype) { + case SOCK_FLOAT: + passonfn = passonvalfn; + break; + case SOCK_VECTOR: + passonfn = passonvecfn; + break; + case SOCK_RGBA: + passonfn = passoncolfn; + break; + default: + passonfn = NULL; + } + for(i = 0; i < lnk->num_outs; i++) { + if(((bNodeStack*)(lnk->in))->data && passonfn) + tex_output(node, in, ((bNodeStack*)(lnk->outs))+i, passonfn, data); + } + /* If num_outs > 1, lnk->outs was an allocated table of pointers... */ + if(i > 1) + MEM_freeN(lnk->outs); + } + BLI_freelistN(&links); +} + void ntreeTexCheckCyclics(struct bNodeTree *ntree) { bNode *node; diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index 766cc73c330..5095a9799e4 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -119,4 +119,6 @@ void tex_do_preview(bNode *node, float *coord, float *col); void params_from_cdata(TexParams *out, TexCallData *in); +void node_tex_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out); + #endif diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index dc96f5abcb5..0ed6d232b81 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -168,5 +168,8 @@ void register_node_type_tex_output(bNodeTreeType *ttype) node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); node_type_exec(&ntype, exec); + /* Do not allow muting output. */ + node_type_mute(&ntype, NULL, NULL); + nodeRegisterType(ttype, &ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 4b4a9fdb4eb..a588f13f18f 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -65,5 +65,8 @@ void register_node_type_tex_viewer(bNodeTreeType *ttype) node_type_size(&ntype, 100, 60, 150); node_type_exec(&ntype, exec); + /* Do not allow muting viewer node. */ + node_type_mute(&ntype, NULL, NULL); + nodeRegisterType(ttype, &ntype); } From d1af9fae3745b2a61132b5d6ce1a4e175c445853 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Sun, 20 Nov 2011 16:57:50 +0000 Subject: [PATCH 202/203] Fix for crasher when node group tree datablocks are missing. --- .../nodes/composite/nodes/node_composite_common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index 1b38609ce24..f3e0edfc691 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -119,6 +119,9 @@ static void *group_initexec(bNode *node) bNodeSocket *sock; bNodeStack *ns; + if (!ngroup) + return NULL; + /* initialize the internal node tree execution */ exec = ntreeCompositBeginExecTree(ngroup, 0); @@ -137,7 +140,8 @@ static void group_freeexec(bNode *UNUSED(node), void *nodedata) { bNodeTreeExec *gexec= (bNodeTreeExec*)nodedata; - ntreeCompositEndExecTree(gexec, 0); + if (gexec) + ntreeCompositEndExecTree(gexec, 0); } /* Copy inputs to the internal stack. @@ -191,6 +195,9 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node { bNodeTreeExec *exec= (bNodeTreeExec*)nodedata; + if (!exec) + return; + /* XXX same behavior as trunk: all nodes inside group are executed. * it's stupid, but just makes it work. compo redesign will do this better. */ From 4ab1dadf72a821b344a714fff59aed11d15ecb14 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 20 Nov 2011 17:09:54 +0000 Subject: [PATCH 203/203] Remove sensor height from Sony A55 preset. Sensor height isn't supported by motion tracking yet. --- release/scripts/presets/tracking_camera/Sony_A55.py | 1 - 1 file changed, 1 deletion(-) diff --git a/release/scripts/presets/tracking_camera/Sony_A55.py b/release/scripts/presets/tracking_camera/Sony_A55.py index f3095c6ec28..5805bfa41db 100644 --- a/release/scripts/presets/tracking_camera/Sony_A55.py +++ b/release/scripts/presets/tracking_camera/Sony_A55.py @@ -2,7 +2,6 @@ import bpy camera = bpy.context.edit_movieclip.tracking.camera camera.sensor_width = 23.4 -camera.sensor_height = 15.6 camera.units = 'MILLIMETERS' camera.focal_length = 24.0 camera.pixel_aspect = 1