[Bf-blender-cvs] [c2e2e93] strand_nodes: Merge branch 'object_nodes' into strand_nodes

Lukas Tönne noreply at git.blender.org
Sun Jul 24 13:16:37 CEST 2016


Commit: c2e2e93152ca49b7911831aed3023d6ce11ef393
Author: Lukas Tönne
Date:   Sun Jul 24 13:10:12 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBc2e2e93152ca49b7911831aed3023d6ce11ef393

Merge branch 'object_nodes' into strand_nodes

===================================================================



===================================================================

diff --cc release/scripts/nodes/hair_nodes.py
index 83fd4e1,0000000..3166d1e
mode 100644,000000..100644
--- a/release/scripts/nodes/hair_nodes.py
+++ b/release/scripts/nodes/hair_nodes.py
@@@ -1,179 -1,0 +1,183 @@@
 +# ##### 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.
 +#
 +# ##### END GPL LICENSE BLOCK #####
 +
 +# <pep8-80 compliant>
 +
 +import bpy
 +import nodeitems_utils
 +from bpy.types import Operator, ObjectNode, NodeTree, Node
 +from bpy.props import *
 +from nodeitems_utils import NodeCategory, NodeItem
 +from mathutils import *
 +from common_nodes import NodeTreeBase, NodeBase, DynamicSocketListNode, enum_property_copy, enum_property_value_prop
 +import group_nodes
 +
 +###############################################################################
 +
 +
 +# our own base class with an appropriate poll function,
 +# so the categories only show up in our own tree type
 +class HairNodeCategory(NodeCategory):
 +    @classmethod
 +    def poll(cls, context):
 +        tree = context.space_data.edit_tree
 +        return tree and tree.bl_idname == 'HairNodeTree'
 +
 +###############################################################################
 +
 +class HairNodeTree(NodeTreeBase, NodeTree):
 +    '''Hair nodes'''
 +    bl_idname = 'HairNodeTree'
 +    bl_label = 'Hair Nodes'
 +    bl_icon = 'MESH_DATA'
 +
 +    # does not show up in the editor header
 +    @classmethod
 +    def poll(cls, context):
 +        return False
 +
 +    def init_default(self):
 +        pass
 +
 +
 +class HairNodeBase(NodeBase):
 +    @classmethod
 +    def poll(cls, ntree):
 +        return ntree.bl_idname == 'HairNodeTree'
 +
 +###############################################################################
 +
 +class HairNodesNew(Operator):
 +    """Create new hair node tree"""
 +    bl_idname = "object_nodes.hair_nodes_new"
 +    bl_label = "New"
 +    bl_options = {'REGISTER', 'UNDO'}
 +
 +    name = StringProperty(
 +            name="Name",
 +            default="HairNodes",
 +            )
 +
 +    @classmethod
 +    def make_node_tree(cls, name="HairNodes"):
 +        ntree = bpy.data.node_groups.new(name, HairNodeTree.bl_idname)
 +        if ntree:
 +            ntree.init_default()
 +        return ntree
 +
 +    def execute(self, context):
 +        node = getattr(context, "node", None)
 +        ntree = self.make_node_tree(self.name)
 +        if ntree is None:
 +            return {'CANCELLED'}
 +        if node:
 +            node.id = ntree
 +        return {'FINISHED'}
 +
 +###############################################################################
 +
 +class HairInputNode(HairNodeBase, ObjectNode):
 +    '''Hair inputs'''
 +    bl_idname = 'HairInputNode'
 +    bl_label = 'Hair'
 +
 +    def init(self, context):
 +        self.outputs.new('NodeSocketVector', "Location")
 +        self.outputs.new('NodeSocketFloat', "Parameter")
 +        self.outputs.new('TransformSocket', "Target")
 +
 +    def compile(self, compiler):
 +        compiler.map_output(0, compiler.graph_input("location"))
 +        compiler.map_output(1, compiler.graph_input("parameter"))
 +        compiler.map_output(2, compiler.graph_input("target"))
 +
 +class HairDeformNode(HairNodeBase, ObjectNode):
 +    '''Hair displacement result'''
 +    bl_idname = 'HairDeformNode'
 +    bl_label = 'Hair Displacement'
 +
 +    def init(self, context):
 +        self.inputs.new('NodeSocketVector', "Target")
 +
 +    def compile(self, compiler):
 +        compiler.map_input(0, compiler.graph_output("offset"))
 +
 +###############################################################################
 +
 +def register():
 +    bpy.utils.register_module(__name__)
 +    gnode, ginput, goutput = group_nodes.make_node_group_types(
 +        "Hair", HairNodeTree, HairNodeBase)
 +
 +    node_categories = [
 +        HairNodeCategory("GEO_INPUT", "Input", items=[
 +            NodeItem("HairInputNode"),
 +            NodeItem(ginput.bl_idname),
 +            NodeItem("ObjectValueFloatNode"),
 +            NodeItem("ObjectValueIntNode"),
 +            NodeItem("ObjectValueVectorNode"),
 +            NodeItem("ObjectValueColorNode"),
 +            ]),
 +        HairNodeCategory("GEO_OUTPUT", "Output", items=[
 +            NodeItem("HairDeformNode"),
 +            NodeItem(goutput.bl_idname),
 +            ]),
 +        HairNodeCategory("GEO_CONVERTER", "Converter", items=[
 +            NodeItem("ObjectSeparateVectorNode"),
 +            NodeItem("ObjectCombineVectorNode"),
++            NodeItem("ObjectSeparateMatrixNode"),
++            NodeItem("ObjectCombineMatrixNode"),
 +            ]),
 +        HairNodeCategory("GEO_MATH", "Math", items=[
 +            NodeItem("ObjectMathNode"),
 +            NodeItem("ObjectVectorMathNode"),
++            NodeItem("ObjectMatrixMathNode"),
++            NodeItem("ObjectTransformVectorNode"),
 +            NodeItem("ObjectTranslationTransformNode"),
 +            NodeItem("ObjectEulerTransformNode"),
 +            NodeItem("ObjectAxisAngleTransformNode"),
 +            NodeItem("ObjectScaleTransformNode"),
 +            NodeItem("ObjectGetTranslationNode"),
 +            NodeItem("ObjectGetEulerNode"),
 +            NodeItem("ObjectGetAxisAngleNode"),
 +            NodeItem("ObjectGetScaleNode"),
 +            NodeItem("ObjectRandomNode"),
 +            ]),
 +        HairNodeCategory("GEO_TEXTURE", "Texture", items=[
 +            NodeItem("ImageSampleNode"),
 +            NodeItem("ObjectTextureCloudsNode"),
 +            NodeItem("ObjectTextureDistNoiseNode"),
 +            NodeItem("ObjectTextureGaborNoiseNode"),
 +            NodeItem("ObjectTextureMagicNode"),
 +            NodeItem("ObjectTextureMarbleNode"),
 +            NodeItem("ObjectTextureMusgraveNode"),
 +            NodeItem("ObjectTextureStucciNode"),
 +            NodeItem("ObjectTextureVoronoiNode"),
 +            NodeItem("ObjectTextureWoodNode"),
 +            ]),
 +        HairNodeCategory("GEO_CURVE", "Curve", items=[
 +            NodeItem("CurvePathNode"),
 +            ]),
 +        group_nodes.GroupNodeCategory("HAIR", gnode, ginput, goutput),
 +        ]
 +    nodeitems_utils.register_node_categories("HAIR_NODES", node_categories)
 +
 +def unregister():
 +    nodeitems_utils.unregister_node_categories("HAIR_NODES")
 +
 +    bpy.utils.unregister_module(__name__)
diff --cc source/blender/gpu/shaders/gpu_shader_bvm_nodes_base.glsl
index 1fc23e4,0000000..6d40991
mode 100644,000000..100644
--- a/source/blender/gpu/shaders/gpu_shader_bvm_nodes_base.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_bvm_nodes_base.glsl
@@@ -1,93 -1,0 +1,114 @@@
 +void V_NOOP()
 +{
 +}
 +
 +void V_VALUE_FLOAT(const float value, out float result)
 +{
 +	result = value;
 +}
 +void D_VALUE_FLOAT(const float value, out float dresult)
 +{
 +	dresult = float(0.0);
 +}
 +
 +void V_VALUE_FLOAT3(const vec3 value, out vec3 result)
 +{
 +	result = value;
 +}
 +void D_VALUE_FLOAT3(const vec3 value, out vec3 dresult)
 +{
 +	dresult = vec3(0.0, 0.0, 0.0);
 +}
 +
 +void V_VALUE_FLOAT4(const vec4 value, out vec4 result)
 +{
 +	result = value;
 +}
 +void D_VALUE_FLOAT4(const vec4 value, out vec4 dresult)
 +{
 +	dresult = vec4(0.0, 0.0, 0.0, 0.0);
 +}
 +
 +void V_VALUE_INT(const int value, out int result)
 +{
 +	result = value;
 +}
 +
 +void V_VALUE_MATRIX44(const mat4 value, out mat4 result)
 +{
 +	result = value;
 +}
 +
 +
 +void V_FLOAT_TO_INT(float value, out int result)
 +{
 +	result = int(value);
 +}
 +
 +void V_INT_TO_FLOAT(int value, out float result)
 +{
 +	result = float(value);
 +}
 +void D_INT_TO_FLOAT(int value, out float dresult)
 +{
 +	dresult = float(0.0);
 +}
 +
 +void V_SET_FLOAT3(float x, float y, float z, out vec3 result)
 +{
 +	result = vec3(x, y, z);
 +}
 +void D_SET_FLOAT3(float x, float dx, float y, float dy, float z, float dz, out vec3 dresult)
 +{
 +	dresult = vec3(dx, dy, dz);
 +}
 +
 +void V_GET_ELEM_FLOAT3(int index, vec3 vec, out float result)
 +{
 +	result = vec[index];
 +}
 +void D_GET_ELEM_FLOAT3(int index, vec3 vec, vec3 dvec, out float result)
 +{
 +	result = dvec[index];
 +}
 +
 +void V_SET_FLOAT4(float x, float y, float z, float w, out vec4 result)
 +{
 +	result = vec4(x, y, z, w);
 +}
 +void D_SET_FLOAT4(float x, float dx, float y, float dy,
 +                  float z, float dz, float w, float dw,
 +                  out vec4 dresult)
 +{
 +	dresult = vec4(dx, dy, dz, dw);
 +}
 +
 +void V_GET_ELEM_FLOAT4(int index, vec4 f, out float result)
 +{
 +	result = f[index];
 +}
 +void D_GET_ELEM_FLOAT4(int index, vec4 f, vec4 df, out float dresult)
 +{
 +	dresult = df[index];
 +}
++
++void V_SET_MATRIX44(float v00, float v01, float v02, float v03,
++	                float v10, float v11, float v12, float v13,
++	                float v20, float v21, float v22, float v23,
++	                float v30, float v31, float v32, float v33,
++	                out mat4 result)
++{
++	result = mat4(v00, v01, v02, v03,
++		          v10, v11, v12, v13,
++		          v20, v21, v22, v23,
++		          v30, v31, v32, v33);
++}
++
++void V_GET_ELEM_MATRIX44(int column, int row, mat4 m, out float result)
++{
++	result = m[column][row];
++}
++void D_GET_ELEM_MATRIX44(int column, int row, mat4 m, out float dresult)
++{
++	dresult = 0.0;
++}
diff --cc source/blender/gpu/shaders/gpu_shader_bvm_nodes_math.glsl
index dfd432d,0000000..660023b
mode 100644,000000..100644
--- a/source/blender/gpu/shaders/gpu_shader_bvm_nodes_math.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_bvm_nodes_math.glsl
@@@ -1

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list