Exporting animations from blender to use with Assimp - blender

I noticed that if I export my blender project as a obj-file I have the option to toggle "Export Animation" which will make alot of files, one for each frame.
I wanted to use the Collada (.dae) format to export my animations. Problem is, when I load my Collada file it says that NumAnimations == 0!
1) Why does a file that is supposed to store animation say 0 animation?
2) When I do get it to work, how to I swap between frames in Assimp?

1) Animation import should work, your problem is probably the export. Have you tried reading through your collada file? Watch for <library_animations> and the like.
2) Assimp has no notion of frames. aiAnimation consists of multiple channels (aiNodeAnim) which define transformations (keyframes) for nodes at specific ticks/time. To compute all transformations one needs to interpolate the correct keyframes depending on the current playback time and mTicksPerSecond of aiAnimation.

Related

Blender collada export multiple animations

I want to export a model with multiple actions to Collada file to use it in openGL ES2, the collada exporter exports only the selected or active action, after many researches I did not find a solution but get idea which is making actions in the same animation in different frames and separate them by the code so I added custom properties to the object to define each action start and end frame but the exporter does not export these properties too, I find a patch which enable the exporter to add custom properties but I can not build from source code because I do not have experience in visual C++ and python, so I appreciate any solution to achieve exporting multiple animations in one dae file.
There is no way with the builtin Blender Collada exporter. I wrote my own Python exporter with the ability to grab animations from the NLA Editor and output multiple animations as elements in Collada. https://github.com/gregeryb/Better-Collada-1.5-DAE-export-plugin-for-Blender

How to import a triangle mesh into SketchUp with small faces?

I'm trying to import a triangle mesh from file (e.g., .3ds, .dae). However, it seems that some of the faces (triangles) are being ignored. If I scale the model by 10x before importing, then the triangles are in tact. Is there a way to force sketchup to load all faces, even small ones?
Here's an example of loading a closed mesh (no boundaries) at its regular scale. SketchUp has ignored a few of the triangles, creating holes and dangling edges:
If I shrink the model, the problems are much worse:
But if I scale up the model enough, the problems go away:
Also, immediately after I import my cursor is set to "move mode", so the object is placed wherever my cursor randomly happens to be. Is there a way to import the model exactly into the current coordinate system without mouse interaction?
Yes, it's a known problem that Sketchup doesn't import very small edges/faces correctly. You can automate the import process of an upscaled model with this ruby script though:
model = Sketchup.active_model
# Import your dwg file, true if you want the summary screen
model.import 'C:\path\to\example.dwg', false
# Reset the selected tool
model.select_tool(nil)
# Get all imported faces
faces = model.entities.grep(Sketchup::Face)
# Create a new ComponentDefinition
definition = model.definitions.add "dwg"
# Add the points of every face to the definition
faces.each{|f| definition.entities.add_face f.vertices}
# Remove all entities
model.entities.clear!
# Create a new DefinitionInstance that is scaled by 0.5
transformation = Geom::Transformation.new(0.5)
instance = model.entities.add_instance definition, transformation
# Explode the component to work with the model
instance.explode
This adds the component to the origin and takes care of scaling the imported model back. If your model were a skp file, you could even load it directly into a ComponentDefinition, but that doesn't work for dwg files.

Easiest method to export a SceneKit scene as a Collada .dae file?

I have an algorithmically-generated SceneKit scene that I'd like to be able to export as a Collada .dae file, e.g. for use in iBooks Author. Since SceneKit can import Collada files, I thought there might be a way to export them too, but couldn't find anything in the API.
Is there an easier way of doing this short of writing my own exporter that iterates over every node/geometry etc?
SCNScene has a writeToURL:options:delegate:progressHandler: OS X-only method that exports DAE. Keep in mind that DAE doesn't handle all features of SceneKit, though. Also note this method isn't available in iOS. (Though if you're preparing content for iBooks Author that's probably not a concern.)

QML Component Screen Rendering

Is it possible to capture the screen rendering of a QML Component and save it to an image file? I would like to drive a Component through several different states, and capture its visual appearance for documentation purposes, without having to do screen/window captures.
Yes, you could set up your state transitions to call QWidget::grab then save it to a file through QPixmap.
If you need an example of how to set up your code to call QWidget::grab take a look at this answer: How to take ScreenShot Qt/QML
It's important to replace QPixmap::grabWidget with QWidget::grab because QPixmap::grabWidget is now obsolete. Once you have the QPixmap from QWidget::grab follow the documentation in QPixmap to save to the format you'd like such as jpeg, png, gif.
Here are some links to the documentation to help you out.
QWidget::grab
QPixmap
QPixmap::save
With Qt 5.4 it is now made easier with grabToImage - this method resides on all QQuickItem objects.
EDIT
It's worth mentioning that the item you call grabToImage() on must be a child of a top-level Window item container

Loading terrains in Ogre and creating navigation mesh with Recast/Detour

I'm new to using Ogre and especially Recast/Detour, and I need a little help.
I'm loading a terrain in Ogre and creating a navigation mesh over the top of it with Recast/Detour. I wanted to loaded more complex terrains because as of right now, I can only load .mesh files which as far as I know can't contain other objects, like buildings, etc. I have two ways that I can think of to do this:
1) Export the .obj files with Blender to .scene files. Then use a third party .scene loader, like DotScene, to load these into Ogre. Then I'd have to figure out how to get Recast to create the navigation mesh on top of a whole scene.
2) Or use Ogre's new terrain loading system, which I haven't read much up on yet.
So if you've worked on a project that uses Ogre and Recast/Detour, how did you accomplish the loading of your terrains and creation of your navigation meshes?
EDIT:
I found a third option that will allow me to keep my current solution but to also load complex terrains. I figured out a way to combine Ogre meshes into one giant mesh file using Blender. I can still load the terrain as a .scene but the navmesh creation procedure does not work with the entities loaded that way, whereas a giant mesh loaded can use the same functionality I already had.
I have no experience with Recast or Detour, hence cannot really comment on your question, but I can point you to OgreCrowd which is a project that works with Ogre::Terrain + Recast/Detour and is open-source. So it might provide some inspirations/ideas/pointers:
Ogre Forum Thread: OgreCrowd - a crowd component for Ogre using Recast/Detour
This corresponding video shows that it can handle Terrain plus additional objects on top of it, so it matches your scenario.