diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2018-05-28 16:25:41 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2018-05-28 16:25:41 +0300 |
commit | e673be1ebc83b1c156eb608935dace95437eccba (patch) | |
tree | 1737cc02db725997b34ca7c4601f5c89002849c8 /intern/cycles | |
parent | 95c5d1193f12375cd7423be9bde1606cd0a05809 (diff) | |
parent | dc0eed178a0f71634399a61b929a544e554ef6aa (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/addon/osl.py | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 20 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 3 |
3 files changed, 16 insertions, 10 deletions
diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py index 19f2ecc9d1a..dd92ce642d4 100644 --- a/intern/cycles/blender/addon/osl.py +++ b/intern/cycles/blender/addon/osl.py @@ -112,7 +112,8 @@ def update_script_node(node, report): if ok: # now update node with new sockets - ok = _cycles.osl_update_node(node.id_data.as_pointer(), node.as_pointer(), oso_path) + data = bpy.data.as_pointer() + ok = _cycles.osl_update_node(data, node.id_data.as_pointer(), node.as_pointer(), oso_path) if not ok: report({'ERROR'}, "OSL query failed to open " + oso_path) diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 56c19c1827a..84b90cb53de 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -410,13 +410,17 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject * /*args*/ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) { - PyObject *pynodegroup, *pynode; + PyObject *pydata, *pynodegroup, *pynode; const char *filepath = NULL; - if(!PyArg_ParseTuple(args, "OOs", &pynodegroup, &pynode, &filepath)) + if(!PyArg_ParseTuple(args, "OOOs", &pydata, &pynodegroup, &pynode, &filepath)) return NULL; /* RNA */ + PointerRNA dataptr; + RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr); + BL::BlendData b_data(dataptr); + PointerRNA nodeptr; RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr); BL::ShaderNodeScript b_node(nodeptr); @@ -514,7 +518,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) b_sock = b_node.outputs[param->name.string()]; /* remove if type no longer matches */ if(b_sock && b_sock.bl_idname() != socket_type) { - b_node.outputs.remove(b_sock); + b_node.outputs.remove(b_data, b_sock); b_sock = BL::NodeSocket(PointerRNA_NULL); } } @@ -522,7 +526,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) b_sock = b_node.inputs[param->name.string()]; /* remove if type no longer matches */ if(b_sock && b_sock.bl_idname() != socket_type) { - b_node.inputs.remove(b_sock); + b_node.inputs.remove(b_data, b_sock); b_sock = BL::NodeSocket(PointerRNA_NULL); } } @@ -530,9 +534,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) if(!b_sock) { /* create new socket */ if(param->isoutput) - b_sock = b_node.outputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str()); + b_sock = b_node.outputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str()); else - b_sock = b_node.inputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str()); + b_sock = b_node.inputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str()); /* set default value */ if(data_type == BL::NodeSocket::type_VALUE) { @@ -566,7 +570,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) for(b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) { if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) { - b_node.inputs.remove(*b_input); + b_node.inputs.remove(b_data, *b_input); removed = true; break; } @@ -574,7 +578,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) for(b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) { if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) { - b_node.outputs.remove(*b_output); + b_node.outputs.remove(b_data, *b_output); removed = true; break; } diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 806f1cad03e..d45d4543e16 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -898,9 +898,10 @@ void LightManager::tag_update(Scene * /*scene*/) int LightManager::add_ies_from_file(ustring filename) { string content; + /* If the file can't be opened, call with an empty line */ if(filename.empty() || !path_read_text(filename.c_str(), content)) { - content == "\n"; + content = "\n"; } return add_ies(ustring(content)); |