Jump to content
Hash, Inc. Forums

Archived

This topic is now archived and is closed to further replies.

Styler

How to add shortcut to Model into Chor

Recommended Posts

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?

Share this post


Link to post
Share on other sites

ok. after removing this line

chor->InsertChildAtTail(mdl, TRUE);

it start working as expected. Kind of understand why it behaves odd

Share this post


Link to post
Share on other sites

You're getting good at this!

 

We expect to see some cool plugins some day!

Share this post


Link to post
Share on other sites

I still have an issue. As I understood without

chor->InsertChildAtTail(mdl, TRUE);

model will be added, but with default settings. When I apply some transformations on brand new model it works only locally. After, in scene all values are equal zero. Actually start hating this shit =(

Share this post


Link to post
Share on other sites

When I apply some transformations on brand new model it works only locally. After, in scene all values are equal zero. Actually start hating this shit =(

 

It works but then it doesn't? I'm not clear on when it stops working.

 

With only one exception i can think of, changes made to a model in a chor do not ever affect the original model.

Share this post


Link to post
Share on other sites

×