Re: [CPP] Storing data in a compileOp
| Date : Mon, 12 Dec 2005 14:03:20 +0000 |
| To : XSI(at)Softimage.COM |
| From : Alan Jones <skyphyr(at)gmail.com> |
| Subject : Re: [CPP] Storing data in a compileOp |
Thanks for that - just to check I've followed - I have my operator class and it stays as is - then I just use it to create an pass data through to my other class which has any additional functionality I want?
Seeing this position is the offset I thought I may want to change it to whatever the current difference is. hmmm actually I just realised something - I've been assuming all this time that init is called on creation and term on deletion. Is that the case or is it called everytime I load up the scene as well? i.e. will this data persist between saves?
Cheers,
Alan.
On 12/12/05, Guy Rabiller <guy(at)alamaison.fr
> wrote:
> ../.. The data should persist until I
> delete the compiledOperator. ../..
This should be automatic, as long as you use a class for your compiled operator rather than directly using the callbacks.
First create a Class wich has the 3 members Init/Update/Term with similar arguments as of the callbacks.
Then when in the operator Init callback, create a new instance of your class then
CYourClass* pYourInstancePointer = new CYourClass();
inCtx.PutUserData( (CValue::siPtrType)pYourInstancePointer );
pYourInstancePointer->Init(inCtx);
In the Update and Term, retrieve your pointer:
CValue::siPtrType pUserData = in_ctx.GetUserData();
CYourClass* pYourInstancePointer = (CYourClass*)pUserData;
and either
pYourInstancePointer->Term(inCtx)
or
pYourInstancePointer->Update(inCtx, outPort)
Now your Class can contain any public or private members/properties, and it will be persistent until you delete the operator.
> ../..I'm making a customOperator that will be working ../..
I meant why would you want to call the function from outside of your Class/Operator ?
--
guy rabiller | 3d technical director (at) LaMaison
Alan Jones a écrit :Hi Guy,
The data should persist until I delete the compiledOperator.
I'm making a customOperator that will be working as a constraint and I want to store the initial position of the point being constrained relative to another point (using pointLocatorData and a vector in tangent space) so I want to store both of those pieces during the init function. Then later I was to grab those - check the changed position of the point it's relative to and figure out the new location.
Cheers,
Alan.
On 12/12/05, Guy Rabiller <guy(at)alamaison.fr > wrote:
> ../.. I'd like to store some data (a vector)
> in my compiled op for it to reference later ../..
Define 'later' ?
How 'far' the data(s) should be persistent ?
> ../.. is there a way to call my own functions on the class ../..
Why would you do that ?
--
guy rabiller | 3d technical director (at) LaMaison
Alan Jones a écrit :
> Hi All,
>
> I'd like to store some data (a vector) in my compiled op for it to
> reference later - though I don't want the user to see it.
>
> I've looked at the init function - which seems like a good enough
> place to start, but can't seem to find a nice place to keep it. Is
> adding my own variables to the class going to break anything? or is
> that how I should be doing it?
>
> It might be nice to be able to change it from a command too - is there
> a way to call my own functions on the class if I add them or is
> update, init and term or I can really work within.
>
> Thanks for any help.
>
> Cheers,
>
> Alan.
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi
- Follow-Ups:
- Re: [CPP] Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Re: [CPP] Storing data in a compileOp
- References:
- Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Re: Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: [CPP] Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Storing data in a compileOp
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: RE: RealFlow Help
- Next by Date: RE: RealFlow Help
- Previous by Thread: RE: RealFlow Help
- Next by Thread: RE: RealFlow Help
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |