[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42723] branches/soc-2011-tomato: Merging r42648 through r42722 from trunk into soc-2011-tomato
Sergey Sharybin
sergey.vfx at gmail.com
Mon Dec 19 11:39:55 CET 2011
Revision: 42723
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42723
Author: nazgul
Date: 2011-12-19 10:39:40 +0000 (Mon, 19 Dec 2011)
Log Message:
-----------
Merging r42648 through r42722 from trunk into soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42648
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42722
Modified Paths:
--------------
branches/soc-2011-tomato/CMakeLists.txt
branches/soc-2011-tomato/build_files/scons/config/win32-mingw-config.py
branches/soc-2011-tomato/intern/cycles/app/cycles_xml.cpp
branches/soc-2011-tomato/intern/cycles/blender/blender_shader.cpp
branches/soc-2011-tomato/intern/cycles/kernel/CMakeLists.txt
branches/soc-2011-tomato/intern/cycles/kernel/osl/nodes/CMakeLists.txt
branches/soc-2011-tomato/intern/cycles/kernel/svm/svm.h
branches/soc-2011-tomato/intern/cycles/kernel/svm/svm_types.h
branches/soc-2011-tomato/intern/cycles/render/graph.cpp
branches/soc-2011-tomato/intern/cycles/render/graph.h
branches/soc-2011-tomato/intern/cycles/render/nodes.cpp
branches/soc-2011-tomato/intern/cycles/render/nodes.h
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_node.py
branches/soc-2011-tomato/source/blender/avi/intern/avi.c
branches/soc-2011-tomato/source/blender/avi/intern/codecs.c
branches/soc-2011-tomato/source/blender/avi/intern/endian.c
branches/soc-2011-tomato/source/blender/avi/intern/mjpeg.c
branches/soc-2011-tomato/source/blender/avi/intern/options.c
branches/soc-2011-tomato/source/blender/avi/intern/rgb32.c
branches/soc-2011-tomato/source/blender/blenkernel/BKE_customdata.h
branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
branches/soc-2011-tomato/source/blender/blenkernel/BKE_object.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/CCGSubSurf.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/CCGSubSurf.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/DerivedMesh.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/anim.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/armature.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/boids.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/camera.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/cdderivedmesh.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/customdata.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/deform.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/dynamicpaint.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/fcurve.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/image.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/image_gen.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/lattice.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/mball.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/object.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/ocean.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/particle.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/pointcache.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/suggestions.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/text.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
branches/soc-2011-tomato/source/blender/blenlib/BLI_ghash.h
branches/soc-2011-tomato/source/blender/blenlib/BLI_math_base.h
branches/soc-2011-tomato/source/blender/blenlib/BLI_math_matrix.h
branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h
branches/soc-2011-tomato/source/blender/blenlib/BLI_utildefines.h
branches/soc-2011-tomato/source/blender/blenlib/intern/BLI_dynstr.c
branches/soc-2011-tomato/source/blender/blenlib/intern/BLI_ghash.c
branches/soc-2011-tomato/source/blender/blenlib/intern/BLI_linklist.c
branches/soc-2011-tomato/source/blender/blenlib/intern/BLI_memarena.c
branches/soc-2011-tomato/source/blender/blenlib/intern/bpath.c
branches/soc-2011-tomato/source/blender/blenlib/intern/edgehash.c
branches/soc-2011-tomato/source/blender/blenlib/intern/math_base_inline.c
branches/soc-2011-tomato/source/blender/blenlib/intern/math_matrix.c
branches/soc-2011-tomato/source/blender/blenlib/intern/math_rotation.c
branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector.c
branches/soc-2011-tomato/source/blender/blenlib/intern/rand.c
branches/soc-2011-tomato/source/blender/blenlib/intern/winstuff.c
branches/soc-2011-tomato/source/blender/collada/AnimationExporter.cpp
branches/soc-2011-tomato/source/blender/collada/AnimationImporter.cpp
branches/soc-2011-tomato/source/blender/collada/ArmatureExporter.cpp
branches/soc-2011-tomato/source/blender/collada/ArmatureImporter.cpp
branches/soc-2011-tomato/source/blender/collada/DocumentImporter.cpp
branches/soc-2011-tomato/source/blender/collada/TransformReader.cpp
branches/soc-2011-tomato/source/blender/collada/TransformWriter.cpp
branches/soc-2011-tomato/source/blender/collada/collada_utils.cpp
branches/soc-2011-tomato/source/blender/editors/animation/keyingsets.c
branches/soc-2011-tomato/source/blender/editors/armature/editarmature.c
branches/soc-2011-tomato/source/blender/editors/curve/curve_ops.c
branches/soc-2011-tomato/source/blender/editors/curve/editcurve.c
branches/soc-2011-tomato/source/blender/editors/include/ED_mesh.h
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_intern.h
branches/soc-2011-tomato/source/blender/editors/interface/interface_panel.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_regions.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_widgets.c
branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_lib.c
branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_tools.c
branches/soc-2011-tomato/source/blender/editors/mesh/mesh_navmesh.c
branches/soc-2011-tomato/source/blender/editors/mesh/meshtools.c
branches/soc-2011-tomato/source/blender/editors/object/object_add.c
branches/soc-2011-tomato/source/blender/editors/object/object_constraint.c
branches/soc-2011-tomato/source/blender/editors/object/object_hook.c
branches/soc-2011-tomato/source/blender/editors/object/object_relations.c
branches/soc-2011-tomato/source/blender/editors/object/object_vgroup.c
branches/soc-2011-tomato/source/blender/editors/physics/physics_pointcache.c
branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_vertex.c
branches/soc-2011-tomato/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2011-tomato/source/blender/editors/sound/sound_ops.c
branches/soc-2011-tomato/source/blender/editors/space_action/action_select.c
branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
branches/soc-2011-tomato/source/blender/editors/space_graph/graph_select.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_draw.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_edit.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_intern.h
branches/soc-2011-tomato/source/blender/editors/space_node/node_ops.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_select.c
branches/soc-2011-tomato/source/blender/editors/space_node/node_state.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_select.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/drawanimviz.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/drawvolume.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_buttons.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_edit.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_fly.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_select.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_snap.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_view.c
branches/soc-2011-tomato/source/blender/editors/transform/transform.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_constraints.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_generics.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_manipulator.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_ops.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_orientations.c
branches/soc-2011-tomato/source/blender/editors/uvedit/uvedit_ops.c
branches/soc-2011-tomato/source/blender/gpu/intern/gpu_codegen.c
branches/soc-2011-tomato/source/blender/gpu/intern/gpu_draw.c
branches/soc-2011-tomato/source/blender/gpu/intern/gpu_extensions.c
branches/soc-2011-tomato/source/blender/gpu/intern/gpu_material.c
branches/soc-2011-tomato/source/blender/ikplugin/intern/iksolver_plugin.c
branches/soc-2011-tomato/source/blender/ikplugin/intern/itasc_plugin.cpp
branches/soc-2011-tomato/source/blender/imbuf/intern/anim_movie.c
branches/soc-2011-tomato/source/blender/imbuf/intern/bmp.c
branches/soc-2011-tomato/source/blender/imbuf/intern/jp2.c
branches/soc-2011-tomato/source/blender/imbuf/intern/util.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_api.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_array.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_boolean_util.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_cast.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_hook.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_meshdeform.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_mirror.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_screw.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_solidify.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_warp.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_wave.c
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_weightvgproximity.c
branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt
branches/soc-2011-tomato/source/blender/nodes/NOD_shader.h
branches/soc-2011-tomato/source/blender/nodes/shader/nodes/node_shader_normal.c
branches/soc-2011-tomato/source/blender/python/generic/bgl.c
branches/soc-2011-tomato/source/blender/python/generic/idprop_py_api.c
branches/soc-2011-tomato/source/blender/python/generic/py_capi_utils.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_app.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_app_handlers.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_driver.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_props.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_rna.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_rna_anim.c
branches/soc-2011-tomato/source/blender/python/intern/bpy_rna_callback.c
branches/soc-2011-tomato/source/blender/python/intern/gpu.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils.h
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Color.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Euler.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Matrix.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Matrix.h
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Quaternion.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Vector.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_Vector.h
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_geometry.c
branches/soc-2011-tomato/source/blender/python/mathutils/mathutils_noise.c
branches/soc-2011-tomato/source/blender/quicktime/apple/qtkit_export.m
branches/soc-2011-tomato/source/blender/quicktime/apple/quicktime_export.c
branches/soc-2011-tomato/source/blender/render/intern/source/convertblender.c
branches/soc-2011-tomato/source/blender/render/intern/source/envmap.c
branches/soc-2011-tomato/source/blender/render/intern/source/pointdensity.c
branches/soc-2011-tomato/source/blender/render/intern/source/render_texture.c
branches/soc-2011-tomato/source/blender/render/intern/source/shadbuf.c
branches/soc-2011-tomato/source/blender/render/intern/source/shadeinput.c
branches/soc-2011-tomato/source/blender/render/intern/source/strand.c
branches/soc-2011-tomato/source/blender/render/intern/source/volumetric.c
branches/soc-2011-tomato/source/blender/render/intern/source/zbuf.c
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_draw.c
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_init_exit.c
branches/soc-2011-tomato/source/gameengine/Converter/BL_ArmatureChannel.cpp
branches/soc-2011-tomato/source/gameengine/Ketsji/BL_Texture.cpp
branches/soc-2011-tomato/source/gameengine/Ketsji/KX_PythonInit.cpp
branches/soc-2011-tomato/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
Added Paths:
-----------
branches/soc-2011-tomato/intern/cycles/kernel/osl/nodes/node_gamma.osl
branches/soc-2011-tomato/intern/cycles/kernel/osl/nodes/node_normal.osl
branches/soc-2011-tomato/intern/cycles/kernel/svm/svm_gamma.h
branches/soc-2011-tomato/intern/cycles/kernel/svm/svm_normal.h
branches/soc-2011-tomato/source/blender/nodes/shader/nodes/node_shader_gamma.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber:37517
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-42647
+ /branches/soc-2011-cucumber:37517
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-42722
Modified: branches/soc-2011-tomato/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/CMakeLists.txt 2011-12-19 08:26:53 UTC (rev 42722)
+++ branches/soc-2011-tomato/CMakeLists.txt 2011-12-19 10:39:40 UTC (rev 42723)
@@ -649,10 +649,6 @@
set(ICONV_LIBPATH ${ICONV}/lib)
endif()
- set(PNG "${LIBDIR}/png")
- set(PNG_INCLUDE_DIR "${PNG}/include")
- set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
-
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
@@ -733,6 +729,10 @@
set(PNG_LIBRARIES libpng_st)
endif()
set(JPEG_LIBRARIES libjpeg)
+
+ set(PNG "${LIBDIR}/png")
+ set(PNG_INCLUDE_DIR "${PNG}/include")
+ set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
if(CMAKE_CL_64)
@@ -913,6 +913,10 @@
set(GETTEXT_LIBPATH ${GETTEXT}/lib)
set(GETTEXT_LIBRARIES intl)
endif()
+
+ set(PNG "${LIBDIR}/gcc/png")
+ set(PNG_INCLUDE_DIR "${PNG}/include")
+ set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
set(JPEG_LIBRARIES libjpeg)
set(PNG_LIBRARIES png)
Modified: branches/soc-2011-tomato/build_files/scons/config/win32-mingw-config.py
===================================================================
--- branches/soc-2011-tomato/build_files/scons/config/win32-mingw-config.py 2011-12-19 08:26:53 UTC (rev 42722)
+++ branches/soc-2011-tomato/build_files/scons/config/win32-mingw-config.py 2011-12-19 10:39:40 UTC (rev 42723)
@@ -64,7 +64,7 @@
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/png'
+BF_PNG = LIBDIR + 'gcc/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
Modified: branches/soc-2011-tomato/intern/cycles/app/cycles_xml.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/app/cycles_xml.cpp 2011-12-19 08:26:53 UTC (rev 42722)
+++ branches/soc-2011-tomato/intern/cycles/app/cycles_xml.cpp 2011-12-19 10:39:40 UTC (rev 42723)
@@ -368,6 +368,9 @@
xml_read_enum(&wood->type, WaveTextureNode::type_enum, node, "type");
snode = wood;
}
+ else if(string_iequals(node.name(), "normal")) {
+ snode = new NormalNode();
+ }
else if(string_iequals(node.name(), "mapping")) {
snode = new MappingNode();
}
@@ -443,6 +446,9 @@
xml_read_enum(&mix->type, MixNode::type_enum, node, "type");
snode = mix;
}
+ else if(string_iequals(node.name(), "gamma")) {
+ snode = new GammaNode();
+ }
else if(string_iequals(node.name(), "combine_rgb")) {
snode = new CombineRGBNode();
}
Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_shader.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_shader.cpp 2011-12-19 08:26:53 UTC (rev 42722)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_shader.cpp 2011-12-19 10:39:40 UTC (rev 42723)
@@ -50,28 +50,6 @@
/* Graph */
-static BL::NodeSocket get_node_input(BL::Node *b_group_node, BL::NodeSocket b_in)
-{
- if(b_group_node) {
-
- BL::NodeTree b_ntree = BL::NodeGroup(*b_group_node).node_tree();
- BL::NodeTree::links_iterator b_link;
-
- for(b_ntree.links.begin(b_link); b_link != b_ntree.links.end(); ++b_link) {
- if(b_link->to_socket().ptr.data == b_in.ptr.data) {
- BL::Node::inputs_iterator b_gin;
-
- for(b_group_node->inputs.begin(b_gin); b_gin != b_group_node->inputs.end(); ++b_gin)
- if(b_gin->group_socket().ptr.data == b_link->from_socket().ptr.data)
- return *b_gin;
-
- }
- }
- }
-
- return b_in;
-}
-
static BL::NodeSocket get_node_output(BL::Node b_node, const string& name)
{
BL::Node::outputs_iterator b_out;
@@ -121,7 +99,7 @@
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)
+static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNode b_node)
{
ShaderNode *node = NULL;
@@ -132,7 +110,6 @@
case BL::ShaderNode::type_GEOMETRY: break;
case BL::ShaderNode::type_MATERIAL: break;
case BL::ShaderNode::type_MATERIAL_EXT: break;
- case BL::ShaderNode::type_NORMAL: break;
case BL::ShaderNode::type_OUTPUT: break;
case BL::ShaderNode::type_SCRIPT: break;
case BL::ShaderNode::type_SQUEEZE: break;
@@ -161,6 +138,10 @@
node = new InvertNode();
break;
}
+ case BL::ShaderNode::type_GAMMA: {
+ node = new GammaNode();
+ break;
+ }
case BL::ShaderNode::type_MIX_RGB: {
BL::ShaderNodeMixRGB b_mix_node(b_node);
MixNode *mix = new MixNode();
@@ -198,6 +179,17 @@
node = vmath;
break;
}
+ case BL::ShaderNode::type_NORMAL: {
+ BL::Node::outputs_iterator out_it;
+ b_node.outputs.begin(out_it);
+ BL::NodeSocketVectorNone vec_sock(*out_it);
+
+ NormalNode *norm = new NormalNode();
+ norm->direction = get_float3(vec_sock.default_value());
+
+ node = norm;
+ break;
+ }
case BL::ShaderNode::type_MAPPING: {
BL::ShaderNodeMapping b_mapping_node(b_node);
MappingNode *mapping = new MappingNode();
@@ -456,59 +448,115 @@
return SocketPair(node_map[b_node.ptr.data], name);
}
-static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, BL::Node *b_group_node, PtrSockMap& sockets_map)
+static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
{
+ switch (b_type) {
+ case BL::NodeSocket::type_VALUE:
+ return SHADER_SOCKET_FLOAT;
+ case BL::NodeSocket::type_VECTOR:
+ return SHADER_SOCKET_VECTOR;
+ case BL::NodeSocket::type_RGBA:
+ return SHADER_SOCKET_COLOR;
+ case BL::NodeSocket::type_SHADER:
+ return SHADER_SOCKET_CLOSURE;
+
+ case BL::NodeSocket::type_BOOLEAN:
+ case BL::NodeSocket::type_MESH:
+ case BL::NodeSocket::type_INT:
+ default:
+ return SHADER_SOCKET_FLOAT;
+ }
+}
+
+static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
+{
+ /* copy values for non linked inputs */
+ switch(input->type) {
+ case SHADER_SOCKET_FLOAT: {
+ BL::NodeSocketFloatNone value_sock(sock);
+ input->set(value_sock.default_value());
+ break;
+ }
+ case SHADER_SOCKET_COLOR: {
+ BL::NodeSocketRGBA rgba_sock(sock);
+ input->set(get_float3(rgba_sock.default_value()));
+ break;
+ }
+ case SHADER_SOCKET_NORMAL:
+ case SHADER_SOCKET_POINT:
+ case SHADER_SOCKET_VECTOR: {
+ BL::NodeSocketVectorNone vec_sock(sock);
+ input->set(get_float3(vec_sock.default_value()));
+ break;
+ }
+ case SHADER_SOCKET_CLOSURE:
+ break;
+ }
+}
+
+static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
+{
/* add nodes */
BL::ShaderNodeTree::nodes_iterator b_node;
PtrNodeMap node_map;
- map<void*, PtrSockMap> node_groups;
+ PtrSockMap proxy_map;
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
if(b_node->is_a(&RNA_NodeGroup)) {
+ /* add proxy converter nodes for inputs and outputs */
BL::NodeGroup b_gnode(*b_node);
BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
-
- node_groups[b_node->ptr.data] = PtrSockMap();
- add_nodes(b_data, graph, b_group_ntree, &b_gnode, node_groups[b_node->ptr.data]);
+ BL::Node::inputs_iterator b_input;
+ BL::Node::outputs_iterator b_output;
+
+ PtrSockMap group_sockmap;
+
+ for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
+ ShaderSocketType extern_type = convert_socket_type(b_input->type());
+ ShaderSocketType intern_type = convert_socket_type(b_input->group_socket().type());
+ ShaderNode *proxy = graph->add(new ProxyNode(extern_type, intern_type));
+
+ /* map the external node socket to the proxy node socket */
+ proxy_map[b_input->ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+ /* map the internal group socket to the proxy node socket */
+ group_sockmap[b_input->group_socket().ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+
+ /* default input values of the group node */
+ set_default_value(proxy->inputs[0], *b_input);
+ }
+
+ for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
+ ShaderSocketType extern_type = convert_socket_type(b_output->type());
+ ShaderSocketType intern_type = convert_socket_type(b_output->group_socket().type());
+ ShaderNode *proxy = graph->add(new ProxyNode(intern_type, extern_type));
+
+ /* map the external node socket to the proxy node socket */
+ proxy_map[b_output->ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+ /* map the internal group socket to the proxy node socket */
+ group_sockmap[b_output->group_socket().ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+
+ /* default input values of internal, unlinked group outputs */
+ set_default_value(proxy->inputs[0], b_output->group_socket());
+ }
+
+ add_nodes(b_data, graph, b_group_ntree, group_sockmap);
}
else {
- ShaderNode *node = add_node(b_data, graph, b_group_node, BL::ShaderNode(*b_node));
-
+ ShaderNode *node = add_node(b_data, graph, BL::ShaderNode(*b_node));
+
if(node) {
BL::Node::inputs_iterator b_input;
- BL::Node::outputs_iterator b_output;
-
+
node_map[b_node->ptr.data] = node;
-
+
for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
SocketPair pair = node_socket_map_pair(node_map, *b_node, *b_input);
ShaderInput *input = pair.first->input(pair.second.c_str());
- BL::NodeSocket sock(get_node_input(b_group_node, *b_input));
-
+
assert(input);
-
+
/* copy values for non linked inputs */
- switch(input->type) {
- case SHADER_SOCKET_FLOAT: {
- BL::NodeSocketFloatNone value_sock(sock);
- input->set(value_sock.default_value());
- break;
- }
- case SHADER_SOCKET_COLOR: {
- BL::NodeSocketRGBA rgba_sock(sock);
- input->set(get_float3(rgba_sock.default_value()));
- break;
- }
- case SHADER_SOCKET_NORMAL:
- case SHADER_SOCKET_POINT:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list