diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-04-02 07:22:17 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-04-02 07:22:17 -0300 |
commit | 1572238adb5b68e18cf20ec73b2f437736e21152 (patch) | |
tree | 4cf50ac1dd8d6253f4991ae5cb0b735841e9c661 /tools | |
parent | ebd743f7c215d65c877874cdf58b22437757fbc6 (diff) |
merging okam changes
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/sprite_frames_editor_plugin.cpp | 37 | ||||
-rw-r--r-- | tools/editor/plugins/sprite_frames_editor_plugin.h | 2 | ||||
-rw-r--r-- | tools/export/blender25/io_scene_dae/export_dae.py | 39 |
3 files changed, 59 insertions, 19 deletions
diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index e04d9dfddb..9a9e8ee611 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -229,6 +229,33 @@ void SpriteFramesEditor::_empty_pressed() { } +void SpriteFramesEditor::_empty2_pressed() { + + + int from=-1; + + if (tree->get_selected()) { + + from = tree->get_selected()->get_metadata(0); + sel=from; + + } else { + from=frames->get_frame_count(); + } + + + + Ref<Texture> r; + + undo_redo->create_action("Add Empty"); + undo_redo->add_do_method(frames,"add_frame",r,from+1); + undo_redo->add_undo_method(frames,"remove_frame",from+1); + undo_redo->add_do_method(this,"_update_library"); + undo_redo->add_undo_method(this,"_update_library"); + undo_redo->commit_action(); + +} + void SpriteFramesEditor::_up_pressed() { if (!tree->get_selected()) @@ -322,6 +349,8 @@ void SpriteFramesEditor::_update_library() { ti->set_text(0,"Frame "+itos(i)); ti->set_icon(0,frames->get_frame(i)); } + if (frames->get_frame(i).is_valid()) + ti->set_tooltip(0,frames->get_frame(i)->get_path()); ti->set_metadata(0,i); ti->set_icon_max_width(0,96); if (sel==i) @@ -355,6 +384,7 @@ void SpriteFramesEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&SpriteFramesEditor::_input_event); ObjectTypeDB::bind_method(_MD("_load_pressed"),&SpriteFramesEditor::_load_pressed); ObjectTypeDB::bind_method(_MD("_empty_pressed"),&SpriteFramesEditor::_empty_pressed); + ObjectTypeDB::bind_method(_MD("_empty2_pressed"),&SpriteFramesEditor::_empty2_pressed); ObjectTypeDB::bind_method(_MD("_item_edited"),&SpriteFramesEditor::_item_edited); ObjectTypeDB::bind_method(_MD("_delete_pressed"),&SpriteFramesEditor::_delete_pressed); ObjectTypeDB::bind_method(_MD("_paste_pressed"),&SpriteFramesEditor::_paste_pressed); @@ -387,9 +417,13 @@ SpriteFramesEditor::SpriteFramesEditor() { hbc->add_child(paste); empty = memnew( Button ); - empty->set_text("Insert Empty"); + empty->set_text("Insert Empty (Before)"); hbc->add_child(empty); + empty2 = memnew( Button ); + empty2->set_text("Insert Empty (After)"); + hbc->add_child(empty2); + move_up = memnew( Button ); move_up->set_text("Up"); hbc->add_child(move_up); @@ -422,6 +456,7 @@ SpriteFramesEditor::SpriteFramesEditor() { _delete->connect("pressed", this,"_delete_pressed"); paste->connect("pressed", this,"_paste_pressed"); empty->connect("pressed", this,"_empty_pressed"); + empty2->connect("pressed", this,"_empty2_pressed"); move_up->connect("pressed", this,"_up_pressed"); move_down->connect("pressed", this,"_down_pressed"); file->connect("files_selected", this,"_file_load_request"); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.h b/tools/editor/plugins/sprite_frames_editor_plugin.h index 99c6ad486e..b0f2201b9e 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.h +++ b/tools/editor/plugins/sprite_frames_editor_plugin.h @@ -46,6 +46,7 @@ class SpriteFramesEditor : public PanelContainer { Button *_delete; Button *paste; Button *empty; + Button *empty2; Button *move_up; Button *move_down; Tree *tree; @@ -65,6 +66,7 @@ class SpriteFramesEditor : public PanelContainer { void _file_load_request(const DVector<String>& p_path); void _paste_pressed(); void _empty_pressed(); + void _empty2_pressed(); void _delete_pressed(); void _delete_confirm_pressed(); void _up_pressed(); diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 5e5febfb1f..020ab6ca08 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -208,13 +208,16 @@ class DaeExporter: imgid = self.new_id("image") + + print("FOR: "+imgpath) - if (not os.path.isfile(imgpath)): - if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): - imgpath="images/"+os.path.basename(imgpath) - else: - imgpath="images/"+image.name+".png" - +# if (not os.path.isfile(imgpath)): +# print("NOT FILE?") +# if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): +# imgpath="images/"+os.path.basename(imgpath) +# else: +# imgpath="images/"+image.name+".png" + self.writel(S_IMGS,1,'<image id="'+imgid+'" name="'+image.name+'">') self.writel(S_IMGS,2,'<init_from>'+imgpath+'</init_from>"/>') self.writel(S_IMGS,1,'</image>') @@ -529,8 +532,8 @@ class DaeExporter: if (not (f.material_index in surface_indices)): surface_indices[f.material_index]=[] - print("Type: "+str(type(f.material_index))) - print("IDX: "+str(f.material_index)+"/"+str(len(mesh.materials))) + #print("Type: "+str(type(f.material_index))) + #print("IDX: "+str(f.material_index)+"/"+str(len(mesh.materials))) try: #Bizarre blender behavior i don't understand, so catching exception @@ -914,14 +917,14 @@ class DaeExporter: if (node.data.shape_keys!=None): sk = node.data.shape_keys if (sk.animation_data): - print("HAS ANIM") - print("DRIVERS: "+str(len(sk.animation_data.drivers))) + #print("HAS ANIM") + #print("DRIVERS: "+str(len(sk.animation_data.drivers))) for d in sk.animation_data.drivers: if (d.driver): for v in d.driver.variables: for t in v.targets: if (t.id!=None and t.id.name in self.scene.objects): - print("LINKING "+str(node)+" WITH "+str(t.id.name)) + #print("LINKING "+str(node)+" WITH "+str(t.id.name)) self.armature_for_morph[node]=self.scene.objects[t.id.name] @@ -1234,7 +1237,7 @@ class DaeExporter: il+=1 self.writel(S_NODES,il,'<matrix sid="transform">'+strmtx(node.matrix_local)+'</matrix>') - print("NODE TYPE: "+node.type+" NAME: "+node.name) + #print("NODE TYPE: "+node.type+" NAME: "+node.name) if (node.type=="MESH"): self.export_mesh_node(node,il) elif (node.type=="CURVE"): @@ -1258,7 +1261,7 @@ class DaeExporter: return False if (self.config["use_active_layers"]): valid=False - print("NAME: "+node.name) + #print("NAME: "+node.name) for i in range(20): if (node.layers[i] and self.scene.layers[i]): valid=True @@ -1408,7 +1411,7 @@ class DaeExporter: # Change frames first, export objects last # This improves performance enormously - print("anim from: "+str(start)+" to "+str(end)+" allowed: "+str(allowed)) + #print("anim from: "+str(start)+" to "+str(end)+" allowed: "+str(allowed)) for t in range(start,end+1): self.scene.frame_set(t) key = t * frame_len - frame_sub @@ -1462,7 +1465,7 @@ class DaeExporter: bone_name=self.skeleton_info[node]["bone_ids"][bone] if (not (bone_name in xform_cache)): - print("has bone: "+bone_name) + #print("has bone: "+bone_name) xform_cache[bone_name]=[] posebone = node.pose.bones[bone.name] @@ -1548,15 +1551,15 @@ class DaeExporter: bone.matrix_basis = Matrix() - print("allowed skeletons "+str(allowed_skeletons)) + #print("allowed skeletons "+str(allowed_skeletons)) - print(str(x)) + #print(str(x)) tcn = self.export_animation(int(x.frame_range[0]),int(x.frame_range[1]+0.5),allowed_skeletons) framelen=(1.0/self.scene.render.fps) start = x.frame_range[0]*framelen end = x.frame_range[1]*framelen - print("Export anim: "+x.name) + #print("Export anim: "+x.name) self.writel(S_ANIM_CLIPS,1,'<animation_clip name="'+x.name+'" start="'+str(start)+'" end="'+str(end)+'">') for z in tcn: self.writel(S_ANIM_CLIPS,2,'<instance_animation url="#'+z+'"/>') |