-=-=-

-Fixed normalmap depth parameter
-Fixes to DirAccess on Windows
-Double click on resource dock will open them
-Fixes to doc generator (should make github wiki on class list more up to date)
This commit is contained in:
Juan Linietsky 2014-10-14 19:44:41 -03:00
parent 94e35ef316
commit cd218b8c09
10 changed files with 35 additions and 26 deletions

View file

@ -678,6 +678,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
mode_replace_table[1]["TANGENT"]="tangent"; mode_replace_table[1]["TANGENT"]="tangent";
mode_replace_table[1]["BINORMAL"]="binormal"; mode_replace_table[1]["BINORMAL"]="binormal";
mode_replace_table[1]["NORMALMAP"]="normalmap"; mode_replace_table[1]["NORMALMAP"]="normalmap";
mode_replace_table[1]["NORMALMAP_DEPTH"]="normaldepth";
mode_replace_table[1]["VAR1"]="var1_interp"; mode_replace_table[1]["VAR1"]="var1_interp";
mode_replace_table[1]["VAR2"]="var2_interp"; mode_replace_table[1]["VAR2"]="var2_interp";
mode_replace_table[1]["UV"]="uv"; mode_replace_table[1]["UV"]="uv";

View file

@ -824,6 +824,8 @@ void main() {
vec3 normalmap = vec3(0.0); vec3 normalmap = vec3(0.0);
#endif #endif
float normaldepth=1.0;
#if defined(ENABLE_DISCARD) #if defined(ENABLE_DISCARD)
@ -839,7 +841,8 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_NORMALMAP) #if defined(ENABLE_NORMALMAP)
normal = normalize( tangent_interp * normalmap.x + binormal_interp * normalmap.y + normal_interp * normalmap.z ) * side; normal = normalize( mix(normal_interp,tangent_interp * normalmap.x + binormal_interp * normalmap.y + normal_interp * normalmap.z,normaldepth) ) * side;
#endif #endif
#if defined(ENABLE_DISCARD) #if defined(ENABLE_DISCARD)

View file

@ -189,10 +189,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
current_dir=real_current_dir_name; // TODO, utf8 parser current_dir=real_current_dir_name; // TODO, utf8 parser
current_dir=current_dir.replace("\\","/"); current_dir=current_dir.replace("\\","/");
} else { } //else {
SetCurrentDirectoryW(prev_dir.c_str()); SetCurrentDirectoryW(prev_dir.c_str());
} //}
return worked?OK:ERR_INVALID_PARAMETER; return worked?OK:ERR_INVALID_PARAMETER;
} else { } else {
@ -210,10 +210,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
current_dir=real_current_dir_name; // TODO, utf8 parser current_dir=real_current_dir_name; // TODO, utf8 parser
current_dir=current_dir.replace("\\","/"); current_dir=current_dir.replace("\\","/");
} else { }// else {
SetCurrentDirectoryA(prev_dir.ascii().get_data()); SetCurrentDirectoryA(prev_dir.ascii().get_data());
} //}
return worked?OK:ERR_INVALID_PARAMETER; return worked?OK:ERR_INVALID_PARAMETER;
@ -352,7 +352,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
DWORD fileAttr; DWORD fileAttr;
fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo); fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr) if (0 == fileAttr)
return false; return false;
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY); return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
@ -361,7 +361,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
DWORD fileAttr; DWORD fileAttr;
fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo); fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr) if (0 == fileAttr)
return false; return false;
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY); return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);

View file

@ -1438,8 +1438,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
if (p_button==BUTTON_LEFT) { if (p_button==BUTTON_LEFT) {
/* process selection */ /* process selection */
if (p_doubleclick && (!c.editable || c.mode==TreeItem::CELL_MODE_CUSTOM || c.mode==TreeItem::CELL_MODE_ICON)) { if (p_doubleclick && (!c.editable || c.mode==TreeItem::CELL_MODE_CUSTOM || c.mode==TreeItem::CELL_MODE_ICON || c.mode==TreeItem::CELL_MODE_CHECK)) {
emit_signal("item_activated"); emit_signal("item_activated");
return -1; return -1;

View file

@ -102,6 +102,8 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) {
} else { } else {
scode+="NORMALMAP=tex( fmp_normal_tex,"+uv_str+").xyz * vec3(2.0,2.0,1.0) - vec3(1.0,1.0,0.0);\n"; scode+="NORMALMAP=tex( fmp_normal_tex,"+uv_str+").xyz * vec3(2.0,2.0,1.0) - vec3(1.0,1.0,0.0);\n";
} }
scode+="NORMALMAP_DEPTH=fmp_normal;\n";
code+=scode; code+=scode;
} }

View file

@ -1043,6 +1043,7 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::fragment_builtins_defs[]={
{ "TANGENT", TYPE_VEC3}, { "TANGENT", TYPE_VEC3},
{ "BINORMAL", TYPE_VEC3}, { "BINORMAL", TYPE_VEC3},
{ "NORMALMAP", TYPE_VEC3}, { "NORMALMAP", TYPE_VEC3},
{ "NORMALMAP_DEPTH", TYPE_FLOAT},
{ "UV", TYPE_VEC2}, { "UV", TYPE_VEC2},
{ "UV2", TYPE_VEC2}, { "UV2", TYPE_VEC2},
{ "COLOR", TYPE_VEC4}, { "COLOR", TYPE_VEC4},

View file

@ -444,9 +444,9 @@ Vector<String> Collada::_read_string_array(XMLParser& parser) {
// parse String data // parse String data
String str = parser.get_node_data(); String str = parser.get_node_data();
array=str.split_spaces(); array=str.split_spaces();
for(int i=0;i<array.size();i++) { //for(int i=0;i<array.size();i++) {
print_line(itos(i)+": "+array[i]); // print_line(itos(i)+": "+array[i]);
} //}
} }
else else
if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END) if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END)

View file

@ -997,8 +997,8 @@ Error DocData::save(const String& p_path) {
_write_string(f,1,"</constants>"); _write_string(f,1,"</constants>");
_write_string(f,1,"<theme_items>");
if (c.theme_properties.size()) { if (c.theme_properties.size()) {
_write_string(f,1,"<theme_items>");
for(int i=0;i<c.theme_properties.size();i++) { for(int i=0;i<c.theme_properties.size();i++) {
@ -1007,9 +1007,10 @@ Error DocData::save(const String& p_path) {
_write_string(f,2,"</theme_item>"); _write_string(f,2,"</theme_item>");
} }
_write_string(f,1,"</theme_items>");
} }
_write_string(f,0,"</theme_items>"); _write_string(f,0,"</class>");
} }

View file

@ -1675,11 +1675,11 @@ void ColladaImport::_fix_param_animation_tracks() {
source=skin.base; source=skin.base;
} else if (collada.state.morph_controller_data_map.has(source)) { } else if (collada.state.morph_controller_data_map.has(source)) {
print_line("has morph");
const Collada::MorphControllerData& morph = collada.state.morph_controller_data_map[source]; const Collada::MorphControllerData& morph = collada.state.morph_controller_data_map[source];
if (morph.targets.has("MORPH_WEIGHT") && morph.targets.has("MORPH_TARGET")) { if (morph.targets.has("MORPH_WEIGHT") && morph.targets.has("MORPH_TARGET")) {
print_line("weight and target");
String weights = morph.targets["MORPH_WEIGHT"]; String weights = morph.targets["MORPH_WEIGHT"];
String targets = morph.targets["MORPH_TARGET"]; String targets = morph.targets["MORPH_TARGET"];
@ -1688,7 +1688,7 @@ void ColladaImport::_fix_param_animation_tracks() {
if (morph.sources.has(targets) && morph.sources.has(weights)) { if (morph.sources.has(targets) && morph.sources.has(weights)) {
const Collada::MorphControllerData::Source &weight_src=morph.sources[weights]; const Collada::MorphControllerData::Source &weight_src=morph.sources[weights];
const Collada::MorphControllerData::Source &target_src=morph.sources[targets]; const Collada::MorphControllerData::Source &target_src=morph.sources[targets];
print_line("sources OK");
ERR_FAIL_COND(weight_src.array.size() != target_src.sarray.size()); ERR_FAIL_COND(weight_src.array.size() != target_src.sarray.size());
@ -1697,7 +1697,6 @@ void ColladaImport::_fix_param_animation_tracks() {
String track_name = weights+"("+itos(i)+")"; String track_name = weights+"("+itos(i)+")";
String mesh_name = target_src.sarray[i]; String mesh_name = target_src.sarray[i];
if (collada.state.mesh_name_map.has(mesh_name) && collada.state.referenced_tracks.has(track_name)) { if (collada.state.mesh_name_map.has(mesh_name) && collada.state.referenced_tracks.has(track_name)) {
print_line("refe tracks");
const Vector<int>&rt = collada.state.referenced_tracks[track_name]; const Vector<int>&rt = collada.state.referenced_tracks[track_name];
@ -1730,7 +1729,7 @@ void ColladaImport::_fix_param_animation_tracks() {
void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) { void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) {
print_line("-=-=-=-=-PRE CA");
_fix_param_animation_tracks(); _fix_param_animation_tracks();
for(int i=0;i<collada.state.animation_clips.size();i++) { for(int i=0;i<collada.state.animation_clips.size();i++) {
@ -1743,7 +1742,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) {
for(int i=0;i<collada.state.animation_tracks.size();i++) { for(int i=0;i<collada.state.animation_tracks.size();i++) {
Collada::AnimationTrack &at = collada.state.animation_tracks[i]; Collada::AnimationTrack &at = collada.state.animation_tracks[i];
print_line("CHANNEL: "+at.target+" PARAM: "+at.param); //print_line("CHANNEL: "+at.target+" PARAM: "+at.param);
if (!node_map.has(at.target)) { if (!node_map.has(at.target)) {
print_line("Coudlnt find node: "+at.target); print_line("Coudlnt find node: "+at.target);
continue; continue;
@ -1762,7 +1761,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) {
} }
create_animation(-1,p_make_tracks_in_all_bones); create_animation(-1,p_make_tracks_in_all_bones);
print_line("clipcount: "+itos(collada.state.animation_clips.size())); //print_line("clipcount: "+itos(collada.state.animation_clips.size()));
for(int i=0;i<collada.state.animation_clips.size();i++) for(int i=0;i<collada.state.animation_clips.size();i++)
create_animation(i,p_make_tracks_in_all_bones); create_animation(i,p_make_tracks_in_all_bones);
@ -1774,10 +1773,10 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
if (p_clip==-1) { if (p_clip==-1) {
print_line("default"); //print_line("default");
animation->set_name("default"); animation->set_name("default");
} else { } else {
print_line("clip name: "+collada.state.animation_clips[p_clip].name); //print_line("clip name: "+collada.state.animation_clips[p_clip].name);
animation->set_name(collada.state.animation_clips[p_clip].name); animation->set_name(collada.state.animation_clips[p_clip].name);
} }
@ -1849,7 +1848,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
base_snapshots.push_back(f); base_snapshots.push_back(f);
f+=snapshot_interval; f+=snapshot_interval;
} }
print_line("anim len: "+rtos(anim_length)); //print_line("anim len: "+rtos(anim_length));
animation->set_length(anim_length); animation->set_length(anim_length);
bool tracks_found=false; bool tracks_found=false;
@ -1874,7 +1873,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Collada::Node *cn = collada.state.scene_map[E->get()]; Collada::Node *cn = collada.state.scene_map[E->get()];
if (cn->ignore_anim) { if (cn->ignore_anim) {
print_line("warning, ignoring animation on node: "+path); //print_line("warning, ignoring animation on node: "+path);
continue; continue;
} }

View file

@ -200,9 +200,11 @@ void ScenesDock::_instance_pressed() {
} }
void ScenesDock::_open_pressed(){ void ScenesDock::_open_pressed(){
TreeItem *sel = tree->get_selected(); TreeItem *sel = tree->get_selected();
if (!sel) if (!sel) {
return; return;
}
String path = sel->get_metadata(0); String path = sel->get_metadata(0);
if (ResourceLoader::get_resource_type(path)=="PackedScene") { if (ResourceLoader::get_resource_type(path)=="PackedScene") {
@ -300,6 +302,7 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->set_v_size_flags(SIZE_EXPAND_FILL);
tree->connect("item_edited",this,"_favorite_toggled"); tree->connect("item_edited",this,"_favorite_toggled");
tree->connect("item_activated",this,"_open_pressed");
timer = memnew( Timer ); timer = memnew( Timer );
timer->set_one_shot(true); timer->set_one_shot(true);