sprockets A:M Decaling Screen frosted donut medals buildings Rubik's Cube Nidaros Cathedral Tongue Sandwich
sprockets
Recent Posts | Unread Content | Previous Banner Topics
Jump to content
Hash, Inc. - Animation:Master

Recommended Posts

Posted

Hello guys, could you help me?
How can I save HModelCache into mdl file? All mdl files start with tags , seems like I need to be inside HOT_MODELFILE container or something like that.

One more question. If select shortcut to object and actually object itself HTreeObject::GetObjectType tells me that it's the same object type. How can I get more explicit answer: who is who?

Thanks!

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Hash Fellow
Posted

Hello guys, could you help me?

How can I save HModelCache into mdl file?

I don't even know what HModelCache is. Is it something in the copy buffer?

 

What circumstance makes you want to put it into mdl?

Posted

Thanks for quick response!

Since AM:SDK doesn't have any documentation, i could just guess what each class supposed to do =) from examples.
As I understood ModelCache is actually shape object, which holds topology information. Model - is instance of ModuleCache. I would like to save specific object back to mdl format after editing its topology. When i run plugin's dialog i have access to HTreeObject that i can cast to HModelCache and get access to its methods.The thing is - it's still reference to mdl file (not actually geometry).
How to jump inside mdl container?

In entry point in HxtOnCommand I have HTreeObject *htreeobject, with type of HOT_MODEL

then I execute CPluginApp dialog and casting this pointer to HModelCache*

// Here is code example:
HModelCache* shape = (HModelCache*)g_selectedTreeObject;

FileStream hs;
hs.Open(filename);
shape->Save(hs);

In beginning of output file i have:
LinkedModel=../Data/Models/Actors/Thom/Thom.mdl

Should be ModelFile container

...

Posted

I can not really give you a good answer but I have asked Steffen if he could have a look into your question. he very likely will come back to you soon on that.

 

see you

*fuchur*

Posted

Actually i found a bug in HModelCache class method

IEPolyModel *BuildExportModel(IEPolyModelParms *iemp, const char *modelmapfilename);

When it builds polymesh for model cache, it flips some face normals in 5 patches, sometimes. I suppose this is a bug in algorithm.

surprisingly it works fine if i do export to OBJ, but for 3DS, LWO it doesn't work properly

 

hash_bug.jpg

  • Hash Fellow
Posted

Actually i found a bug in HModelCache class method

 

IEPolyModel *BuildExportModel(IEPolyModelParms *iemp, const char *modelmapfilename);

 

When it builds polymesh for model cache, it flips some face normals in 5 patches, sometimes. I suppose this is a bug in algorithm.

surprisingly it works fine if i do export to OBJ, but for 3DS, LWO it doesn't work properly...

 

 

Definitely submit that as a bug report at hash.com/reports

 

If you haven't previously submitted a report you'll need to get a password for that site from the admins.

 

 

Make sure to include the sample model your example uses.

  • Developer
Posted

Saving modelcache will work first in V18h , need changes inside A:M and the SDK .

For HModelCache there will be than a HModelChache::ExportModel(FileStream hs) .

Posted

Thanks for information, Steffen!

I'm writing applink for 3DCoat and I faced with the problem that doing import/export process won't so simple, since Hash is purely spline-patch based app. As I understood you have great experience with Hash SDK. Could you tell me.. Do you know any other way to get polymesh than using BuildExportModel method? I'd like to get similar topology like patches have (4 or 5 points faces without forcing post-tesselation down to 4, 3). Thanks for your answers

  • Hash Fellow
Posted

 

I'd like to get similar topology like patches have (4 or 5 points faces without forcing post-tesselation down to 4, 3).

If you export a OBJ with "polygons per patch" set to 1 you'll get the original topology, with 5-pointers as holes.

  • Hash Fellow
Posted

How about this...

 

-Save to MDL

-delete the 5-point patches in the MDL file with a text editor macro

-reload the altered file

-export to OBJ

 

that gets you the original topology with holes for 5-pointers instead of a 4+3 conversion.

Posted

hello,

I do not know if this can help:

for exporting to Blender I needed to export obj patches without subdivision, without holes and with patches with 5 sides.

What I could have found that the triangles are bad writing when exporting:

Type f V1 V2 V3 V1 (As patches CP1 CP2 CP3 CP1) which created with holes for export. By rewriting its triangles f V1 V2 V3, the problem is solved.
Note that the subdision triangles in AM is different that in the polygon programm, because the triangular patch is a patch to four sides of which one side has no length. so that the subdivision is not ideal for export polygonal because it lost loops.

For 5-sided patches exported, I reattached the lines:
f V1 V2 V3 V4
f V1 V4 V5 (oddly its triangles are well written)
in
f V1 V2 V3 V4 V5

For hooks, I did not look for solution. I thought convert Ngons but when subdision this could give more than 5 poles edges, which is not great.

Not being a programmer I used Construct2 to make a small program to correct its convertion problems, here are the files in a zip HTLM5. The program is very slow! But it works with last obj exporter (AMV18).

Posted

Does anybody know how to set In/Out Mantitude for control points in brand new created IEPatchModel object?

Let's say I want to create a new flat patch like quad poly

 

hash_plane.jpg

// create model
IEPatchModel* model = new IEPatchModel;
model->m_vertexlist.SetSize(4);
model->m_vertexlist[0] = Vector(0, 0, 0);
model->m_vertexlist[1] = Vector(1, 0, 0);
model->m_vertexlist[2] = Vector(1, 1, 0);
model->m_vertexlist[3] = Vector(0, 1, 0);

// set up patches
model->m_patcharray.SetSize(1);
IEPatch* patch = new IEPatch(NULL);
model->m_patcharray.SetAt(0, patch);

// vxt index
for (int i = 0; i < 4; i++) {
    patch->m_vertexid[i] = i;
} 

HModelCache *hmc = HModelCache::New("plane");
hmc->MergeIEModel(model, "foo", 0.0, TRUE, TRUE);

Right now i have to set In/Out Mantitude after merging IEModel:

HSpline* sp = hmc->GetHeadSpline();
while (sp) {
    HCP* cp = sp->GetHeadCP();
    while (cp) {
        cp->SetInMagnitude(0.0);
        cp->SetOutMagnitude(0.0);
        cp = cp->GetNext();
    }
    sp = sp->GetNextSpline();
}

Can I set them up on stage of creation patch somehow?

  • Developer
Posted

No , there is no way to do this .

And Your code for setting the magnitudes is not correct .

check for cp->IsLoop() to prevent a infinity loop.

 

HSpline* sp = hmc->GetHeadSpline();
while (sp) {
HCP* cp = sp->GetHeadCP();
while (cp && !cp->IsLoop()) {
cp->SetInMagnitude(0.0);
cp->SetOutMagnitude(0.0);
cp = cp->GetNext();
}
sp = sp->GetNextSpline();
}

 

Most sdk functions are documented , download the file AM120SDKDoc.zip from the sdk download section. It represent not the latest stand , but it's a beginning point .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...