Maya: Create temporary MFnMEsh for smooth export - mesh

Im writing an exporter that exports the subdivision preview mesh via the 'generateSmoothMesh()' method like this:
MFnMesh mesh(mesh_dag_path);
MFnMesh subdiv_mesh(mesh.generateSmoothMesh());
but after the export finishes the new subdivided geometry is left in my maya scene. How should i deal with this geometry, or is this even the right way to be doing this export?
my first instinct is to delete the geometry after the export is finished, if this is the correct thing to do does anybody know he correct way to delete the geometry from the api

Saying you need to do it from the API makes me think this is a command plugin. Correct me if I'm wrong. One way to do it is to run MEL code from your plugin with MGlobal .
MGlobal::executeCommand(MString("delete meshTransform;"));
Where meshTransform is the transform of the newly created mesh. You can get it by having parentOrOwner be MObject::kNullObj.
Or you can directly use:
MGlobal::deleteNode()

Related

Does the Highcharts-Vue wrapper support 'gauge' and 'heatmap' chart types?

https://github.com/highcharts/highcharts-vue
I don't see examples of these in the demo and there is nothing mentioned in the docs. I'm wondering if it is simply not possible or just not demoed because of their more complicated nature.
I will also need to use Charts appendData prototype to make a line chart real-time. Is this possible using the wrapper? I'm thrown by the following in the docs but not sure it it's directly related;
You can access the Chart object instance if necessary (e.g when need
to get some data or use any of Chart.prototype functions), by calling
specific Vue component instance chart field, but it is not supported
to update the chart using its built-in functions
Indeed, the highcharts-vue package supports all official modules included in Highcharts, so it's not necessary to produce every demo from demos site using Vue wrapper. I made the examples with gauge and heatmapseries specially for you, so please take a look on them.
I will also need to use Charts appendData prototype to make a line chart real-time. Is this possible using the wrapper?
A component is watching for changes on provided chart configuration, so if you will update your data (e.g by pushing new points into a series.data), then highcharts-vue will detect it, and automatically update the chart. That's the most recommended way of implementation. If you would like to use some Chart's or Series prototype functions, of course you can do that, but please note that causes inconsistency between the chart data and the data defined within component. Just need to access chart's reference like it is described in Chart object reference section.
Live examples:
https://codesandbox.io/s/vue-template-uqu1p (Gauge),
https://codesandbox.io/s/vue-template-8z2f5 (Heatmap)

AS2 AttachMovie from loaded swf movie

i'm facing one problem about attaching movieclip from loaded movie, so basically we have a Map
Map.loadMovie("SimpleMap.swf");
in this map there's a npc dialogue with its name "Dialogue1" I want to attach it to the client. It should be basically something like
_root.attachMovie("Map.Dialogue1", "dialogue", _root.getNextHighestDepth());
but it seems I can't get it to work. Anyone can help?
Note: Also I want to attach the movieclip to the client instead of the map, else I would use Map.attachMovie
it's been a while since I wrote any Actionscript 2 stuff, but have you tried removing the quotes around Map.Dialogue1 ? - If I remember correctly passing a string would make Flash look for the symbol in the library, not from the global or current scope...
_root.attachMovie(Map.Dialogue1, "dialogue", _root.getNextHighestDepth());
If you want you can import mx.core.UIObject and then use the method _root.createObject() (or if it is O-O use createClassObject()).
It is going to attach the "npc dialog" as an object... you need to specify the linkage name and give the instance a name. So for example if you called the dialog "npc_dialog" in the library then use:
_root.createObject("npc_dialog", "my_npc", _root.getNextHighestDepth());
Here is something else you can try... go to the library and drag a instance of the movie onto the stage somewhere where it will not be seen, like for instance on the next key frame or off the stage then try to run attachMovie().
What happens is flash will compile the clip in the most efficient way possible so if it sees you imported a package but did not use it then it will ignore this class in the compiled clip... so when you go to run and it tries to attach the movie it can't find it.

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.

Changing interactive mode Edge Shape in JUNG

I am aware of the ability using an EdgeShapeTransformer to change the look of edges:
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); // for example
However I am looking for how to change the way the line looks while dragging from one node to another to create an edge interactively. By default the 'hovering' edge which is not yet linked to another node is a large curved line. See the example here for what I mean.
CubicCurveEdgeEffects is where it is done. There is an EdgeEffects interface that can be implemented to do other things instead. It is used by the SimpleEdgeSupport class via the EditingGraphMousePlugin.
(Credit to Tom Nelson, offline communication.)

How do you assign a default Image to the Blob object in Play framework?

I followed this nice article
http://www.lunatech-research.com/playframework-file-upload-blob
and have a perfectly working image upload solution
My questions is, if the user doesn't select any image, how do I assign a default image during save (probably stored in the server)?
if (!user.photo)
user.photo= ?;
user.save();
The one-hack that I can think of is upload the default image and see which UID "Play" stores in the /tmp directory and assign that above. Is there an elegant named* solution to this?
when I say named, I mean I want the code to look like (which means I know what I'm doing and I can also write elegant automated code if there are more than one picture)
user.photo= "images/default/male.jpg"
rather than (which means I'm just hacking and I can't extend it elegantly for a list of pictures)
user.photo= "c0109891-8c9f-4b8e-a533-62341e713a21"
Thanks in advance
The approach I have always taken is to not change the model for empty images, but instead do something in the view to show a default image, if the image does not exist. This I think is a better approach because your are corrupting your model for display purposes, which is bad practice (as you may want to be able to see all those who have not selected an image, for example).
To achieve this, in your view you can simply use the exists() method on the Blob field. The code would look like
#{if user.photo.exists()}
<img src="#{userPhoto(user.id)}">
#{/if}
#{else}
<img src="#{'public/images/defaultUserImage.jpg'}">
#{/else}
I have assumed in the above code that you are rendering the image using the action userPhoto as described in the Lunatech article.
I'd assume you can store the default image somewhere in your applications source folder and use
user.photo.set(new FileInputStream(photo), MimeTypes.getContentType(photo.getName()));
to save the data. Photo is just a File object, so you can get the reference of your default image and use it.