Re: GTKD TreeView - Delete TreeView SubItem with Button?
On Friday, 20 November 2015 at 17:09:50 UTC, TheDGuy wrote: Hello, is it possible, to delete a selected TreeView SubItem with a Button-Click? My Code currently looks like this: import gtk.MainWindow; import gtk.Box; import gtk.Main; import gtk.Button; import gdk.Event; import gtk.Widget; import List, Languages; void main(string[] args){ Main.init(args); MainWindow win = new MainWindow("TreeView Example"); win.setDefaultSize(500,300); Box box = new Box(Orientation.VERTICAL, 0); auto list = new List(); auto german = list.addCountry("German", "Germany"); auto city = list.addCountryCity(german, "German", "Munich"); auto sweden = list.addCountry("Swedish", "Sweden"); auto cit = list.addCountryCity(sweden, "Swedish", "Stockholm"); auto treeView = new LanguageTree(list); box.packStart(treeView, true, true, 0); auto btn_Delete = new Button("Delete"); box.add(btn_Delete); win.add(box); win.showAll(); Main.run(); } class DeleteButton : Button { this(in string text) { super(text); addOnButtonRelease(); } private bool del(Event event, Widget widget) { return true; } } But i neither know how i get the currently selected item nor how i could delete it within the "del"-Event of the "DeleteButton"? TreeIter iter = treeView.getSelectedIter; then you can use the TreeIter to delete the item. If your List is a ListStore or TreeStore, it has a remove method that you can call. If its a custom store you will have to implement it yourself like this class List:TreeModel { . void remove(TreeIter iter) { //maybe remove item from your actual data structure or other processing //send rowDeleted signal rowDeleted(iter); } . }
Re: GTKD TreeView - Delete TreeView SubItem with Button?
On Friday, 20 November 2015 at 19:45:26 UTC, TheDGuy wrote: So like this? public void remove(TreeIter iter) { this.remove(iter); } If i do this, i get a stackoverflow error :( Your List inherits from TreeStore correct? just get rid of your custom remove method entirely, or correctly override it public override void remove(TreeIter iter) { super.remove(iter); }
Re: Derelict Assimp not loading mesh properly? (Maybe index buffer)
On Friday, 6 March 2015 at 02:41:19 UTC, Bennet wrote: I wrote a custom OBJ file importer which worked fairly well however was not robust enough to support everything. I've decided to give AssImp a shot. I followed some tutorials and have set up my code to read in the vertices, tex coords, normals, and indices of an OBJ cube model that I have had success loading with my custom importer. The cube model's faces do not render properly, instead only rendering a few tri's of the cube. The way AssImp handles the data is obviously a bit different than my solution because the normals, positions/vertices, tex coords, and indices do not match my custom solution. I would very much appreciate some insight into why I'm having issues as all of the tutorials I've found have matched my approach. If a picture of the faulty rendered cube would be helpful I can work on getting a screenshot up. Thank you. My Asset importing class is at: http://codebin.org/view/4d2ec4d3 The rest of my code is at (Mesh Class is in source/graphics): https://github.com/BennetLeff/PhySim Imagine a square mesh made up of two triangles, the un-indexed version has 6 vertices, but the indexed version that you would be using has 4 vertices because a side is shared by the two triangles (which is managed by the index array). This is why you can't assume each face has 3 vertices. I have been trying to learn opengl and D recently together and this is the simple code I have been using to load models from assimp. for(int i = 0; i mesh.mNumVertices; i++) { aiVector3D vert = mesh.mVertices[i]; verts ~= vec3(vert.x, vert.y, vert.z); aiVector3D uvw = mesh.mTextureCoords[0][i]; uvs ~= vec2(uvw.x, uvw.y); aiVector3D n = mesh.mNormals[i]; normals ~= vec3(n.x, n.y, n.z); } for(int i = 0; i mesh.mNumFaces; i++) { const aiFace face = mesh.mFaces[i]; indices ~= face.mIndices[0]; indices ~= face.mIndices[1]; indices ~= face.mIndices[2]; }