-intentional breakage of shader graph to fix issues, existing graphs will be broken, sorry :(

This commit is contained in:
Juan Linietsky 2015-01-18 09:51:11 -03:00
parent 91faf8e218
commit 6f3c09047e
5 changed files with 25 additions and 4 deletions

View file

@ -263,12 +263,15 @@ void ShaderGraph::_bind_methods() {
BIND_CONSTANT( NODE_XFORM_TO_VEC ); // 3 vec input ); 1 xform output
BIND_CONSTANT( NODE_SCALAR_INTERP ); // scalar interpolation (with optional curve)
BIND_CONSTANT( NODE_VEC_INTERP ); // vec3 interpolation (with optional curve)
BIND_CONSTANT( NODE_COLOR_RAMP );
BIND_CONSTANT( NODE_CURVE_MAP );
BIND_CONSTANT( NODE_SCALAR_INPUT ); // scalar uniform (assignable in material)
BIND_CONSTANT( NODE_VEC_INPUT ); // vec3 uniform (assignable in material)
BIND_CONSTANT( NODE_RGB_INPUT ); // color uniform (assignable in material)
BIND_CONSTANT( NODE_XFORM_INPUT ); // mat4 uniform (assignable in material)
BIND_CONSTANT( NODE_TEXTURE_INPUT ); // texture input (assignable in material)
BIND_CONSTANT( NODE_CUBEMAP_INPUT ); // cubemap input (assignable in material)
BIND_CONSTANT( NODE_DEFAULT_TEXTURE );
BIND_CONSTANT( NODE_OUTPUT ); // output (shader type dependent)
BIND_CONSTANT( NODE_COMMENT ); // comment
BIND_CONSTANT( NODE_TYPE_MAX );
@ -519,12 +522,15 @@ void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) {
case NODE_XFORM_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output
case NODE_SCALAR_INTERP: {} break; // scalar interpolation (with optional curve)
case NODE_VEC_INTERP: {} break; // vec3 interpolation (with optional curve)
case NODE_COLOR_RAMP: { node.param1=Array();} break; // vec3 interpolation (with optional curve)
case NODE_CURVE_MAP: { node.param1=Array();} break; // vec3 interpolation (with optional curve)
case NODE_SCALAR_INPUT: {node.param1=_find_unique_name("Scalar"); node.param2=0;} break; // scalar uniform (assignable in material)
case NODE_VEC_INPUT: {node.param1=_find_unique_name("Vec3");node.param2=Vector3();} break; // vec3 uniform (assignable in material)
case NODE_RGB_INPUT: {node.param1=_find_unique_name("Color");node.param2=Color();} break; // color uniform (assignable in material)
case NODE_XFORM_INPUT: {node.param1=_find_unique_name("XForm"); node.param2=Transform();} break; // mat4 uniform (assignable in material)
case NODE_TEXTURE_INPUT: {node.param1=_find_unique_name("Tex"); } break; // texture input (assignable in material)
case NODE_CUBEMAP_INPUT: {node.param1=_find_unique_name("Cube"); } break; // cubemap input (assignable in material)
case NODE_CUBEMAP_INPUT: {node.param1=_find_unique_name("Cube"); } break; // cubemap input (assignable in material)
case NODE_DEFAULT_TEXTURE: {}; break;
case NODE_OUTPUT: {} break; // output (shader type dependent)
case NODE_COMMENT: {} break; // comment
case NODE_TYPE_MAX: {};
@ -1299,6 +1305,8 @@ const ShaderGraph::NodeSlotInfo ShaderGraph::node_slot_info[]= {
{NODE_SCALAR_TO_VEC,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // 3 scalar input,{SLOT_MAX},{SLOT_MAX}}, 1 vec3 output
{NODE_SCALAR_INTERP,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar interpolation (with optional curve)
{NODE_VEC_INTERP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 interpolation (with optional curve)
{NODE_COLOR_RAMP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 interpolation (with optional curve)
{NODE_CURVE_MAP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 interpolation (with optional curve)
{NODE_SCALAR_INPUT,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar uniform (assignable in material)
{NODE_VEC_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 uniform (assignable in material)
{NODE_RGB_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // color uniform (assignable in material)
@ -1987,6 +1995,12 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str
case NODE_VEC_INTERP: {
code += OUTNAME(p_node->id,0)+"=mix("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+");\n";
}break;
case NODE_COLOR_RAMP: {
}break;
case NODE_CURVE_MAP: {
}break;
case NODE_SCALAR_INPUT: {
String name = p_node->param1;
@ -2043,6 +2057,10 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str
code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n";
code += OUTNAME(p_node->id,1)+"="+rname+".a;\n";
}break;
case NODE_DEFAULT_TEXTURE: {
} break;
case NODE_OUTPUT: {

View file

@ -66,12 +66,15 @@ public:
NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output
NODE_SCALAR_INTERP, // scalar interpolation (with optional curve)
NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
NODE_COLOR_RAMP, //take scalar, output vec3
NODE_CURVE_MAP, //take scalar, otput scalar
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
NODE_VEC_INPUT, // vec3 uniform (assignable in material)
NODE_RGB_INPUT, // color uniform (assignable in material)
NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
NODE_TEXTURE_INPUT, // texture input (assignable in material)
NODE_CUBEMAP_INPUT, // cubemap input (assignable in material)
NODE_DEFAULT_TEXTURE,
NODE_OUTPUT, // output (shader type dependent)
NODE_COMMENT, // comment
NODE_TYPE_MAX

View file

@ -136,6 +136,7 @@ real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale
return 0;
}
void LineShape2DSW::set_data(const Variant& p_data) {
ERR_FAIL_COND(p_data.get_type()!=Variant::ARRAY);

View file

@ -85,7 +85,6 @@ public:
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const=0;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const=0;
virtual void set_data(const Variant& p_data)=0;
virtual Variant get_data() const=0;

View file

@ -1607,7 +1607,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
edit_menu->get_popup()->add_item("Clone Down",EDIT_CLONE_DOWN,KEY_MASK_CMD|KEY_B);
edit_menu->get_popup()->add_separator();
#ifdef OSX_ENABLED
edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_META|KEY_SPACE);
edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_CTRL|KEY_SPACE);
#else
edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_CMD|KEY_SPACE);
#endif