Yes, we call these "Zombie" objects. We try to avoid any crash occurring but if an object isn't in the scene it isn't safe to use it.
By the way, because of the undo stack, XSI will sometimes keep an object alive but not in the scene and then restore it for "redo". However even in this case it is not safe to use the original CRef object, there is no guarantee that XSI will restore the same object again or create an equivalent new object. Anyway that is just a bit of digression.
-Andrew
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf
Of Luc-Eric Rousseau
Posted At: Thursday, December 15, 2005 6:22 PM
Posted To: xsi
Conversation: [CPP] CRef reference persistence
Subject: RE: [CPP] CRef reference persistence
AFAIK, CRef does reference count what it's pointed to, but you can't prevent objects from being destroyed with this. For example, the input data of an operator will be destroyed when the operator is deleted, if isn't used anywhere else. After an XSI object (3D Objects, operators, properties) has been destroyed, it's not part of the scene, and all of its children have have been released. You can't call any API on it (it would crash), its XSI internals have been destroyed, it's an empty shell. The shell itself will be released from memory ("delete" in the c++ sense) when the reference count hits zero.
------------------
Luc-Eric Rousseau
Team Leader, User Interface
Softimage|XSI
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM
> [mailto:owner-xsi(at)Softimage.COM]On Behalf
> Of Guy Rabiller
> Posted At: Thursday, December 15, 2005 6:06 PM
> Posted To: xsi
> Conversation: [CPP] CRef reference persistence
> Subject: Re: [CPP] CRef reference persistence
>
>
>
> > ../.. And what kind of 'information' is refered
> > by the CRef? UserDataBlob, Kinematics...?../..
>
> Any derived class of CObject. It's more a generic
> interrogation of mine
> rather than a concret case.
> ( I used the term 'object' more in a cpp sense of it than in
> a 'object"
> in the scene ).
>
> > ../..I would say that the SDK provides an interface to the object,
> > and if the object is not here, the interface becomes invalid...
> > I would vote 'no' to your question.../..
>
> Hmm, I'll have to have a second thought about it then.
>
> Allways having hard time to choose to right english words, I
> think what
> describe better my interrogation is:
> Can a CRef instance 'take ownership' of a referenced Object ( another
> instance in the cpp sense ) ?
> Or is just a 'pointer'.
>
> But I use the term 'pointer' carefully in reference to some 'smart
> pointers' wich can take ownership. So depending on the design of the
> smart pointer it can have owner ship of a multi referenced (
> and counted
> ) instance, while being, from the coder point of view, 'just'
> a pointer.
>
> Not sure how CRef handle this internaly.
> ( or if it is just 'none of its business' if you see what I mean ).
> --
> guy rabiller | 3d technical director (at) LaMaison
>
>
>
>
>
>
> Aloys Baillet wrote:
>
> > OK, but how XSI would delete an object without telling
> anyone about it?
> > That would be quite mean of him :-)
> > And what kind of 'information' is refered by the CRef?
> UserDataBlob,
> > Kinematics...?
> > I would say that the SDK provides an interface to the
> object, and if
> > the object is not here, the interface becomes invalid...
> > I would vote 'no' to your question.
> > I would be curious to see what's the real behavior, though!
> >
> > Aloys
> >
> > On 16/12/05, *Guy Rabiller* < guy(at)alamaison.fr
> > <mailto:guy(at)alamaison.fr>> wrote:
> >
> >
> > Coucou Aloys :-)
> >
> > > ../.. Application().ExecuteCommand("DeleteObj",
> oArgs, oRtn); ../..
> >
> > Yeah that's why I said:
> > "../.. ( by XSI, not the user ) ../.."
> >
> > If I delete it myself I would understand the CRef
> becomes invalid :-)
> >
> > But imagine that this object was refering ( by 'him'
> only ) to some
> > 'information', and I got a CRef on that 'information' elsewhere.
> > If that object got deleted, the 'information' needed by
> the object
> > would
> > be logicaly deleted - as nobody need it anymore - but
> now that I got a
> > CRef on it, it must be 'kept alive' right ? Or
> 'reference counted' ?.
> >
> > I mean, I'm pretty sure I can answer 'yes' to my own
> question but
> > there
> > might be subtle cases ( or problems ? ) where it is not
> the case.
> > I just
> > wanted to know if it is guaraned or not.
> >
> > Oh well, I will see it soon enough if there are
> problems, I guess. ;-)
> >
> > Cheers
> > --
> > guy rabiller | 3d technical director (at) LaMaison
> >
> >
> >
> >
> >
> > --
> > Aloys Baillet - XSI Technical Director
> > Character Dpt - Animal Logic
> > --
>
>
> ---
> 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
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi