PDA

View Full Version : API call to load an object ??


pzanna
04-11-2008, 04:36 PM
Does anyone know how to load an object file via the API? The only thing I can find is a host call but there is no documentation on the host APIs.

Thanks

Ulven
04-11-2008, 05:00 PM
Only thing I found after a quick look was a load scene command in the scripting function list. Could work if you have your object in a scene (writing the expression to a variable and then executing with the api). Depends what you're trying to do though...
Maybe peksi or suricate have a better clue.

double LoadScene(string, string)
DESCRIPTION: Load a scene. (filename,flag) flag=REPLACE or APPEND

pzanna
04-11-2008, 05:07 PM
I want to play back a OBJ sequence, but as each object has a different point order and count I can't use any of the standard features......

lanosrep1
04-11-2008, 08:04 PM
I have not used this myself, but may be of help for your task. There is a utility on the Point Oven site that compiles a sequencce of .lwo files into .mdd files. Someone that knows more about this may be able to chime in.. I know you mentioned obj files above.. Not sure it will work for you.. but.. thought I would mention it.

Here is the direct link: http://www.ef9.com/ef9/PO1.5/Download/PO_MDDCompiler.zip

I want to play back a OBJ sequence, but as each object has a different point order and count I can't use any of the standard features......

Suricate
04-11-2008, 08:40 PM
In the messiah API, the mesh loading/saving functionality is currently missing. But can't you just use the 'DMorph' effect with object sequence loading? I remember that a while back (about one year back or maybe more) there were some threads about fluids (with varying point counts) generated in Realflow and Blender, which were rendered in messiah with 'DMorph'. So maybe you can have a search for those threads.

peksi
04-11-2008, 08:45 PM
I am not 100% sure about that lwo to mdd, but I *think* that it doesn't work for pzanna's purposes, as he needs sequence of obj's that may change rather than having a fixed point count and order. Or then theres features in mdd that I don't know of.

By the looks of host connection headers, you *might* be able to load object from file but frustratingly enough there is no doc nor sample code... Can't really help you here. I personally would love to see some sample host code that:
A) shows how to create your own geom / load from file
B) how to set it up with some simple opengl app to display displaced model
C) and maybe show how to pass some arbitrary data between that opengl app and messiah

catizone
04-12-2008, 02:47 PM
According to the docs, DMorph plays back an obj seq. made using Save Morph Seq. So it sounds like the objects would have to have had the same point order.

Not sure what you're trying to do. Perhaps you have an object that has the same point order for a series of changes, and then you have another object that has a short series, and so on. That wouldn't be too bad because you could use DMOrph for parts of this for similar objs. Or, worst case scenario, you have a number of different objs all with different point orders.

Off the top of my head, I can't think of any "efficient" way to do it. I suppose you could multi-select and load them. Key the first object on the first frame and the last hold frame. On the next frame, set scale to zero. Then make the second object's scale at zero, then 100%, then zero. Cumbersome, but relatively fast. (Altho' not fun if you have a 100 objs.)

Or, after keying the second object, maybe you could motion clip and load it onto the rest of the objects and slide them easily in dope sheet? Just a possible solution to a tough problem.


Best,
Rick

pzanna
04-12-2008, 03:45 PM
The effect that I'm trying to get is a model scattering / exploding so that you can see the texture on the individual pieces as they fly towards the camera. There is about 100 frames (its a slow motion effect) - all the objects have the same UVs so I guess I could manually load them all in, assign them the same texture map then cylce thier visability via a script......... I would have prefered to script the loading of them (but there is no script or API function to load an object) so that all the meshes aren't saved in the scene file which will be huge with all the objects in it.

Thanks for all the suggestions.

Paul

Taron333
04-12-2008, 09:13 PM
Dmorph works without a problem! Use Object Replacement Mode. As long as you have your object sequence properly named and all objects loadable, there should be no problem at all.
I just a made a tiny test with arbitrary objects named the same and indexed properly and it worked right away.

If I remember correctly, that is a rather recent change from somewhen within last year, but I'm not sure. I think somebody wanted to use RealFlow and a generated water sequence, which puts out totally independent objects that have nothing in common as to point-order or even -amount. This might not be in the docs, either, which would come to all of us as a shock. I hope we soon get the chance to improve on the docs at least half as much as we did on the code. :surprised

However, I'm curious, would you mind posting 2 or 3 small snapshots of your exploding object sequence? I think it's always best to have something to look at, rather than trying to understand what is needed based on descriptions only.

catizone
04-12-2008, 09:47 PM
WOW! Thanks, Taron. That is really an amazing feature, especially if one were doing transitionary creature stages where the various main stages would be different models and point counts...with appropriate stages created to work one "into" the next shape.

Thanks and Best,
Rick

Taron333
04-12-2008, 10:24 PM
Well, if anything this is inspiring to enhance dmorph yet again to allow the use of deformationtools after the object replacement. Currently that's not what it does, but I think, although slow, this should be possible to put into. There are various improvements I could imagine. The other thing I just noticed is that metanurbs don't stay active on such sequences and that should be the easiest thing to make happen. We'll talk about it internally and see what's possible.

Anyway, great inspirations here! :thumbsup:

rush123
04-12-2008, 10:51 PM
I did do some tests with Blender fluids using DMorph in ‘object replacement mode’ and it work well, though one should remember that a render group is needed for shading or you would have to reapply the shader to every object.

R

Taron333
04-12-2008, 11:41 PM
Yet another thing that could use some improvement, whereby it's a good question what to do best. We are thinking about a few good ways to manage it logically so that it becomes easier to texture whole groups and control parameters of all members.

catizone
04-13-2008, 03:35 AM
And this is an odd afterthought, but besidea scaling, I thought of simply keying the visibility. But never having needed that in messiah, I don't know where we could do that. Can we key visibility parameter?

Best,
Rick

Taron333
04-13-2008, 03:41 AM
If you are talking about opacity, like visibility during rendering, you could simply animate the materials opacity or if it is more than one, just make an expression and hook all related materials into it, for example.

Then there are several other ways of accomplishing something of that kind, which are rather "garage-style", but have always worked... eh... I think you mentioned scaling.

Ulven
04-14-2008, 11:27 AM
It could still be good to have an api call for loading/replacing objects. I could imagine it in use production wise as for instance making a plugin that always keeps the objects in the scene up to date with the latest incremental save of the object.

Taron333
04-14-2008, 01:41 PM
It could have a number of fantastic uses from obvious ones to more off-the-wall type of things as well. I've been thinking about some things already, which could greatly benefit from that.
Objects update is a brilliant idea for sure! :wise:

CGTalk Moderation
04-14-2008, 01:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.