diff options
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 27 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 40 | ||||
-rw-r--r-- | intern/cycles/blender/blender_camera.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_curves.cpp | 16 | ||||
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 53 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 26 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.h | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 12 |
11 files changed, 149 insertions, 50 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 597ac1a9ce0..9459b750bd1 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -114,6 +114,11 @@ enum_volume_sampling = ( ('MULTIPLE_IMPORTANCE', "Multiple Importance", "Combine distance and equi-angular sampling for volumes where neither method is ideal"), ) +enum_volume_interpolation = ( + ('LINEAR', "Linear", "Good smoothness and speed"), + ('CUBIC', 'Cubic', 'Smoothed high quality interpolation, but slower') + ) + class CyclesRenderSettings(bpy.types.PropertyGroup): @classmethod @@ -345,7 +350,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): description="Distance between volume shader samples when rendering the volume " "(lower values give more accurate and detailed results, but also increased render time)", default=0.1, - min=0.0000001, max=100000.0 + min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0 ) cls.volume_max_steps = IntProperty( @@ -617,6 +622,13 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup): default='DISTANCE', ) + cls.volume_interpolation = EnumProperty( + name="Volume Interpolation", + description="Interpolation method to use for volumes", + items=enum_volume_interpolation, + default='LINEAR', + ) + @classmethod def unregister(cls): del bpy.types.Material.cycles @@ -641,6 +653,12 @@ class CyclesLampSettings(bpy.types.PropertyGroup): min=1, max=10000, default=1, ) + cls.max_bounces = IntProperty( + name="Max Bounces", + description="Maximum number of bounces the light will contribute to the render", + min=0, max=1024, + default=1024, + ) cls.use_multiple_importance_sampling = BoolProperty( name="Multiple Importance Sample", description="Use multiple importance sampling for the lamp, " @@ -693,6 +711,13 @@ class CyclesWorldSettings(bpy.types.PropertyGroup): default='EQUIANGULAR', ) + cls.volume_interpolation = EnumProperty( + name="Volume Interpolation", + description="Interpolation method to use for volumes", + items=enum_volume_interpolation, + default='LINEAR', + ) + @classmethod def unregister(cls): del bpy.types.World.cycles diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 9632b12c414..9b1e20d3c8f 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -729,11 +729,11 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): if cscene.progressive == 'BRANCHED_PATH': col.prop(clamp, "samples") + col.prop(clamp, "max_bounces") col = split.column() col.prop(clamp, "cast_shadow") - - layout.prop(clamp, "use_multiple_importance_sampling") + col.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance") if lamp.type == 'HEMI': layout.label(text="Not supported, interpreted as sun lamp") @@ -936,6 +936,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): sub = col.column() sub.active = use_cpu(context) sub.prop(cworld, "volume_sampling", text="") + sub.prop(cworld, "volume_interpolation", text="") col.prop(cworld, "homogeneous_volume", text="Homogeneous") @@ -1019,17 +1020,6 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel): cmat = mat.cycles split = layout.split() - - col = split.column(align=True) - col.prop(mat, "diffuse_color", text="Viewport Color") - col.prop(mat, "alpha") - - col = split.column(align=True) - col.label() - col.prop(mat, "pass_index") - - split = layout.split() - col = split.column() col.label(text="Surface:") col.prop(cmat, "sample_as_light", text="Multiple Importance") @@ -1040,8 +1030,25 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel): sub = col.column() sub.active = use_cpu(context) sub.prop(cmat, "volume_sampling", text="") + col.prop(cmat, "volume_interpolation", text="") col.prop(cmat, "homogeneous_volume", text="Homogeneous") + layout.separator() + split = layout.split() + + col = split.column(align=True) + col.label("Viewport Color:") + col.prop(mat, "diffuse_color", text="") + col.prop(mat, "alpha") + + col.separator() + col.prop(mat, "pass_index") + + col = split.column(align=True) + col.label("Viewport Specular:") + col.prop(mat, "specular_color", text="") + col.prop(mat, "specular_hardness", text="Hardness") + class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): bl_label = "" @@ -1381,7 +1388,11 @@ def get_panels(): "RENDER_PT_encoding", "RENDER_PT_dimensions", "RENDER_PT_stamp", + "RENDER_PT_freestyle", "RENDERLAYER_PT_layers", + "RENDERLAYER_PT_freestyle", + "RENDERLAYER_PT_freestyle_lineset", + "RENDERLAYER_PT_freestyle_linestyle", "SCENE_PT_scene", "SCENE_PT_color_management", "SCENE_PT_custom_props", @@ -1419,6 +1430,7 @@ def get_panels(): "DATA_PT_custom_props_curve", "DATA_PT_custom_props_lattice", "DATA_PT_custom_props_metaball", + "TEXTURE_PT_preview", "TEXTURE_PT_custom_props", "TEXTURE_PT_clouds", "TEXTURE_PT_wood", @@ -1436,6 +1448,7 @@ def get_panels(): "TEXTURE_PT_pointdensity", "TEXTURE_PT_pointdensity_turbulence", "TEXTURE_PT_mapping", + "TEXTURE_PT_ocean", "TEXTURE_PT_influence", "TEXTURE_PT_colors", "PARTICLE_PT_context_particles", @@ -1457,6 +1470,7 @@ def get_panels(): "PARTICLE_PT_force_fields", "PARTICLE_PT_vertexgroups", "MATERIAL_PT_custom_props", + "MATERIAL_PT_freestyle_line", "BONE_PT_custom_props", "OBJECT_PT_custom_props", ] diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index ce8c64c4819..416348f3b91 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -20,6 +20,8 @@ #include "blender_sync.h" #include "blender_util.h" +#include "util_logging.h" + CCL_NAMESPACE_BEGIN /* Blender Camera Intermediate: we first convert both the offline and 3d view @@ -400,6 +402,7 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time) tfm = blender_camera_matrix(tfm, cam->type); if(tfm != cam->matrix) { + VLOG(1) << "Camera " << b_ob.name() << " motion detected."; if(motion_time == -1.0f) { cam->motion.pre = tfm; cam->use_motion = true; diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index 8cfaea59a06..7c8e7d40119 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -25,6 +25,7 @@ #include "blender_util.h" #include "util_foreach.h" +#include "util_logging.h" CCL_NAMESPACE_BEGIN @@ -577,6 +578,10 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData) } } + if (num_curves > 0) { + VLOG(1) << "Exporting curve segments for mesh " << mesh->name; + } + mesh->curve_keys.reserve(mesh->curve_keys.size() + num_keys); mesh->curves.reserve(mesh->curves.size() + num_curves); @@ -612,9 +617,9 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData) } } - /* check allocation*/ + /* check allocation */ if((mesh->curve_keys.size() != num_keys) || (mesh->curves.size() != num_curves)) { - /* allocation failed -> clear data */ + VLOG(1) << "Allocation failed, clearing data"; mesh->curve_keys.clear(); mesh->curves.clear(); mesh->curve_attributes.clear(); @@ -623,12 +628,16 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData) static void ExportCurveSegmentsMotion(Scene *scene, Mesh *mesh, ParticleCurveData *CData, int time_index) { + VLOG(1) << "Exporting curve motion segments for mesh " << mesh->name + << ", time index " << time_index; + /* find attribute */ Attribute *attr_mP = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION); bool new_attribute = false; /* add new attribute if it doesn't exist already */ if(!attr_mP) { + VLOG(1) << "Creating new motion vertex position attribute"; attr_mP = mesh->curve_attributes.add(ATTR_STD_MOTION_VERTEX_POSITION); new_attribute = true; } @@ -675,9 +684,12 @@ static void ExportCurveSegmentsMotion(Scene *scene, Mesh *mesh, ParticleCurveDat if(new_attribute) { if(i != numkeys || !have_motion) { /* no motion, remove attributes again */ + VLOG(1) << "No motion, removing attribute"; mesh->curve_attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION); } else if(time_index > 0) { + VLOG(1) << "Filling in new motion vertex position for time_index" + << time_index; /* motion, fill up previous steps that we might have skipped because * they had no motion, but we need them anyway now */ for(int step = 0; step < time_index; step++) { diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index a5e4b7bd2ae..e8da8a87c1d 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -27,6 +27,7 @@ #include "subd_split.h" #include "util_foreach.h" +#include "util_logging.h" #include "mikktspace.h" @@ -761,11 +762,13 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion if(new_attribute) { if(i != numverts || memcmp(mP, &mesh->verts[0], sizeof(float3)*numverts) == 0) { /* no motion, remove attributes again */ + VLOG(1) << "No actual motion for mesh " << b_mesh.name(); mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION); if(attr_mN) mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_NORMAL); } else if(time_index > 0) { + VLOG(1) << "Filling motion for mesh " << b_mesh.name(); /* motion, fill up previous steps that we might have skipped because * they had no motion, but we need them anyway now */ float3 *P = &mesh->verts[0]; diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 1e07c5f9c96..88bfbf6db74 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -30,6 +30,7 @@ #include "util_foreach.h" #include "util_hash.h" +#include "util_logging.h" CCL_NAMESPACE_BEGIN @@ -168,6 +169,8 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI else light->samples = samples; + light->max_bounces = get_int(clamp, "max_bounces"); + /* visibility */ uint visibility = object_ray_visibility(b_ob); light->use_diffuse = (visibility & PATH_RAY_DIFFUSE) != 0; @@ -249,6 +252,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P if(object && (scene->need_motion() == Scene::MOTION_PASS || object_use_motion(b_ob))) { /* object transformation */ if(tfm != object->tfm) { + VLOG(1) << "Object " << b_ob.name() << " motion detected."; if(motion_time == -1.0f) { object->motion.pre = tfm; object->use_motion = true; @@ -458,10 +462,10 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time) BL::Scene::object_bases_iterator b_base; BL::Scene b_sce = b_scene; /* modifier result type (not exposed as enum in C++ API) - * 1 : DAG_EVAL_PREVIEW - * 2 : DAG_EVAL_RENDER - */ - int dupli_settings = preview ? 1 : 2; + * 1 : DAG_EVAL_PREVIEW + * 2 : DAG_EVAL_RENDER + */ + int dupli_settings = preview ? 1 : 2; bool cancel = false; diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index b756d6acdb2..78a96319163 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -53,14 +53,36 @@ void python_thread_state_restore(void **python_thread_state) *python_thread_state = NULL; } +static const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) +{ +#ifdef WIN32 + /* bug [#31856] oddly enough, Python3.2 --> 3.3 on Windows will throw an + * exception here this needs to be fixed in python: + * see: bugs.python.org/issue15859 */ + if(!PyUnicode_Check(py_str)) { + PyErr_BadArgument(); + return ""; + } +#endif + if((*coerce = PyUnicode_EncodeFSDefault(py_str))) { + return PyBytes_AS_STRING(*coerce); + } + return ""; +} + static PyObject *init_func(PyObject *self, PyObject *args) { - const char *path, *user_path; + PyObject *path, *user_path; - if(!PyArg_ParseTuple(args, "ss", &path, &user_path)) + if(!PyArg_ParseTuple(args, "OO", &path, &user_path)) { return NULL; - - path_init(path, user_path); + } + + PyObject *path_coerce = NULL, *user_path_coerce = NULL; + path_init(PyC_UnicodeAsByte(path, &path_coerce), + PyC_UnicodeAsByte(user_path, &user_path_coerce)); + Py_XDECREF(path_coerce); + Py_XDECREF(user_path_coerce); Py_RETURN_NONE; } @@ -83,7 +105,7 @@ static PyObject *create_func(PyObject *self, PyObject *args) BL::UserPreferences userpref(userprefptr); PointerRNA dataptr; - RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr); + RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr); BL::BlendData data(dataptr); PointerRNA sceneptr; @@ -91,15 +113,15 @@ static PyObject *create_func(PyObject *self, PyObject *args) BL::Scene scene(sceneptr); PointerRNA regionptr; - RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyregion), ®ionptr); + RNA_pointer_create(NULL, &RNA_Region, pylong_as_voidptr_typesafe(pyregion), ®ionptr); BL::Region region(regionptr); PointerRNA v3dptr; - RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyv3d), &v3dptr); + RNA_pointer_create(NULL, &RNA_SpaceView3D, pylong_as_voidptr_typesafe(pyv3d), &v3dptr); BL::SpaceView3D v3d(v3dptr); PointerRNA rv3dptr; - RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyrv3d), &rv3dptr); + RNA_pointer_create(NULL, &RNA_RegionView3D, pylong_as_voidptr_typesafe(pyrv3d), &rv3dptr); BL::RegionView3D rv3d(rv3dptr); /* create session */ @@ -174,7 +196,7 @@ static PyObject *bake_func(PyObject *self, PyObject *args) void *b_result = PyLong_AsVoidPtr(pyresult); PointerRNA bakepixelptr; - RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pypixel_array), &bakepixelptr); + RNA_pointer_create(NULL, &RNA_BakePixel, PyLong_AsVoidPtr(pypixel_array), &bakepixelptr); BL::BakePixel b_bake_pixel(bakepixelptr); python_thread_state_save(&session->python_thread_state); @@ -216,7 +238,7 @@ static PyObject *reset_func(PyObject *self, PyObject *args) BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); PointerRNA dataptr; - RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr); + RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr); BL::BlendData b_data(dataptr); PointerRNA sceneptr; @@ -363,13 +385,7 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args) /* find socket socket */ BL::NodeSocket b_sock(PointerRNA_NULL); if (param->isoutput) { -#if OSL_LIBRARY_VERSION_CODE < 10500 - b_sock = b_node.outputs[param->name]; -#else b_sock = b_node.outputs[param->name.string()]; -#endif - - /* remove if type no longer matches */ if(b_sock && b_sock.bl_idname() != socket_type) { b_node.outputs.remove(b_sock); @@ -377,12 +393,7 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args) } } else { -#if OSL_LIBRARY_VERSION_CODE < 10500 - b_sock = b_node.inputs[param->name]; -#else b_sock = b_node.inputs[param->name.string()]; -#endif - /* remove if type no longer matches */ if(b_sock && b_sock.bl_idname() != socket_type) { b_node.inputs.remove(b_sock); diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 57ffea4b1a9..79ab25483e2 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -92,6 +92,7 @@ void BlenderSession::create_session() /* reset status/progress */ last_status = ""; + last_error = ""; last_progress = -1.0f; start_resize_time = 0.0; @@ -826,10 +827,8 @@ void BlenderSession::update_status_progress() get_status(status, substatus); get_progress(progress, total_time); - - if(background) { - if(progress>0) + if(progress > 0) remaining_time = (1.0 - (double)progress) * (total_time / (double)progress); scene += " | " + b_scene.name(); @@ -843,12 +842,12 @@ void BlenderSession::update_status_progress() if(samples > 0 && total_samples != USHRT_MAX) remaining_time = (total_samples - samples) * (total_time / samples); } - - if(remaining_time>0) { + + if(remaining_time > 0) { BLI_timestr(remaining_time, time_str, sizeof(time_str)); timestatus += "Remaining:" + string(time_str) + " | "; } - + timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", (double)mem_used, (double)mem_peak); if(status.size() > 0) @@ -865,6 +864,21 @@ void BlenderSession::update_status_progress() b_engine.update_progress(progress); last_progress = progress; } + + if (session->progress.get_error()) { + string error = session->progress.get_error_message(); + if(error != last_error) { + /* TODO(sergey): Currently C++ RNA API doesn't let us to + * use mnemonic name for the variable. Would be nice to + * have this figured out. + * + * For until then, 1 << 5 means RPT_ERROR. + */ + b_engine.report(1 << 5, error.c_str()); + b_engine.error_set(error.c_str()); + last_error = error; + } + } } void BlenderSession::tag_update() diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index ac685118b3d..143a23af5c6 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -91,6 +91,7 @@ public: string b_rlay_name; string last_status; + string last_error; float last_progress; int width, height; diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 33c7bf5f859..27c2e9e9ae8 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -1014,7 +1014,8 @@ void BlenderSync::sync_materials(bool update_all) shader->use_mis = get_boolean(cmat, "sample_as_light"); shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow"); shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume"); - shader->volume_sampling_method = RNA_enum_get(&cmat, "volume_sampling"); + shader->volume_sampling_method = (VolumeSampling)RNA_enum_get(&cmat, "volume_sampling"); + shader->volume_interpolation_method = (VolumeInterpolation)RNA_enum_get(&cmat, "volume_interpolation"); shader->set_graph(graph); shader->tag_update(scene); @@ -1044,7 +1045,8 @@ void BlenderSync::sync_world(bool update_all) /* volume */ PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); shader->heterogeneous_volume = !get_boolean(cworld, "homogeneous_volume"); - shader->volume_sampling_method = RNA_enum_get(&cworld, "volume_sampling"); + shader->volume_sampling_method = (VolumeSampling)RNA_enum_get(&cworld, "volume_sampling"); + shader->volume_interpolation_method = (VolumeInterpolation)RNA_enum_get(&cworld, "volume_interpolation"); } else if(b_world) { ShaderNode *closure, *out; diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 2ac90b34fd7..ee492dd00e4 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -515,7 +515,17 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use params.shadingsystem = SHADINGSYSTEM_OSL; /* color managagement */ - params.display_buffer_linear = GLEW_ARB_half_float_pixel && b_engine.support_display_space_shader(b_scene); +#ifdef GLEW_MX + /* When using GLEW MX we need to check whether we've got an OpenGL + * context for current window. This is because command line rendering + * doesn't have OpenGL context actually. + */ + if(glewGetContext() != NULL) +#endif + { + params.display_buffer_linear = GLEW_ARB_half_float_pixel && + b_engine.support_display_space_shader(b_scene); + } return params; } |