sprockets Rodger Reynold's Architectural WIP Live Answer Time Demo Tinkering Gnome's Sparkler PRJ Shelton's new Char: Hans It's just donuts by ItsJustMe 3D Printing Free model: USS Midnight
sprockets
Recent Posts | Unread Content
Jump to content
Hash, Inc. - Animation:Master

Styler

*A:M User*
  • Posts

    51
  • Joined

  • Last visited

Posts posted by Styler

  1. I found the way (taken from SDK)

    HChor *chor;
    HModelCache *hmc_new;
    HModel *working = hmc_new->NewInstance(chor);
    chor->InsertChildAtTail(working,TRUE);

    For some reason it hangs the app

     

    What I do:

    IEPolyModel* model = new IEPolyModel;
    // setting up model..
    
    HModelCache *hmc = HModelCache::New("Foo", TRUE);
    hmc->MergeIEModel(model, "Foo", 0.0, TRUE, TRUE);
    delete model;
    
    HProject* prj = GetHProject();
    
    if (HChorContainer* chors = prj->GetChildChorContainer()) {
        for (HHashObject* c = chors->GetChild(); c; c = c->GetSibling()) {
            HChor* chor = (HChor*)c;            
            HModel* mdl = hmc->NewInstance(chor);
            chor->InsertChildAtTail(mdl, TRUE);
        }
    }
    

    Any ideas?

  2. It's actually here. Thanks for hint

    HDecalContainer* decals = hmc->GetChildDecalContainer();
    if (decals) {
        for (HHashObject* _decal = decals->GetChild(); _decal; _decal = _decal->GetSibling()) {
            HDecal* decal = (HDecal*)_decal;
            HDecalClipContainer* clips = decal->GetChildDecalClipContainer();
            if (clips) {
                for (HHashObject* _clip = clips->GetChild(); _clip; _clip = _clip->GetSibling()) {
                    HClip* clip = (HClip*)_clip;
                    HDecalClip* clipInfo = (HDecalClip*)_clip;
                    UINT kind = clipInfo->GetKind()->GetValue(); // here is a type
                    printf("- %s, type: <%d>\n", clip->GetMatchName().buf, kind);
                }
            }
        }
    }
  3. patches.jpg

     

    I'm trying to build IEPatchModel like on picture (just 2 patches), but Hash is freezing on stage:

    hmc->MergeIEModel(model, "foo", 0.0, TRUE, TRUE);
    Can somebody tell me how to do it properly? What I'm doing wrong? Thanks.

     

    Here is a source code:

    void CreatePlane2() {
        float cps[] = {
            0, 0, 0,        
            0, 1, 0,        
            1, 1, 0,        
            1, 0, 0,        
            2, 1, 0,      
            2, 0, 0   
        };    
    
        int faces4[] = {       
            0, 1, 2, 3,        
            3, 2, 4, 5    
        };    
    
        int numCps = 6;    
        int numPatches = 2;    
    
        // create model    
        IEPatchModel* model = new IEPatchModel;    
        for (int i = 0; i < numCps; i++) {        
            model->m_vertexlist.Add(Vector(cps[i*3], cps[i*3 + 1], cps[i*3 + 2]));    
        }    
    
        // set up patches    
        for (int i = 0; i < numPatches; i++) {        
            IEPatch* patch = new IEPatch(NULL);        
            model->m_patcharray.Add(patch);       
     
            // sep patch indices        
            for (int j = 0; j < 4; j++) {            
                patch->m_vertexid[j] = faces4[i*4 + j];        
            }
        }    
    
        HModelCache *hmc = HModelCache::New("plane");    
        hmc->MergeIEModel(model, "foo", 0.0, TRUE, TRUE);    
        delete model;
    }
  4. 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?

  5. 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

  6. 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

  7. 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

    ...

×
×
  • Create New...