PDA

View Full Version : SDK Q: Deleteing obects on effect delete


FB_Turbine
09-26-2003, 10:28 PM
I have an effect that requires a number of support tools. I'd like to delete these tools if the user deletes the effect, to help clean things up. But when I try to use:

fxObjectDeleteBegin(mymodule, FX_NOFLAG);

fxObjectDelete(objectID, FX_NOFLAG);

fxObjectDeleteEnd(mymodule, FX_NOFLAG);

During the Object_destory event, right before free(state), the items are not deleted. If this is not where I should be deleting objects during which event should I delete the extra tools?

Thanks,

lmilton
09-26-2003, 10:40 PM
Originally posted by FB_Turbine
I have an effect that requires a number of support tools. I'd like to delete these tools if the user deletes the effect, to help clean things up. But when I try to use:

fxObjectDeleteBegin(mymodule, FX_NOFLAG);

fxObjectDelete(objectID, FX_NOFLAG);

fxObjectDeleteEnd(mymodule, FX_NOFLAG);

During the Object_destory event, right before free(state), the items are not deleted. If this is not where I should be deleting objects during which event should I delete the extra tools?

Thanks,

You definately don't what to do an fxObjectDelete* inside of O_DESTROY. It shouldn't crash, but it's still not going to work.

What you need is a way of "flagging" objects for deletion. It doesn't exist in the API, yet. Hmmm... I can't think of a way around this that will be safe.

However, messiah's methodology is that the tools "own" the effect. This is why when tools are deleted, the attached effect is deleted, as well.

Can you provide an illustration of why you'd need to deviate from this?

Thanx

-lyle

FB_Turbine
09-26-2003, 11:36 PM
Here's an example:

I create an effect that centers the target between 2 nulls. When you add the effect It automatically creates the 2 nulls for you. If the user deletes the effect from the scene I'd like to do a little cleanup and delete the 2 nulls that were created when the effect was added.

My actual effect is different from this example but this is a much easier scenario to explain. If you want specific details on the effect I can provide them privately.

edit (spelling)

lmilton
09-26-2003, 11:50 PM
Originally posted by FB_Turbine
Here's an example:

I create an effect that centers the target between 2 nulls. When you add the effect It automatically creates the 2 nulls for you. If the user deletes the effect from the scene I'd like to do a little cleanup and delete the 2 nulls that were created when the effect was added.

My actual effect is different from this example but this is a much easier scenario to explain. If you want specific details on the effect I can provide them privately.

edit (spelling)

But what if the user uses those same nulls for other purposes? This is why we leave everything in the user's control, and everything is "object-centric".

I think what you really need is some sort of "multinull" tool. Alternatively, you could use a Curve tool, and just create 2 points (Points are essentially Nulls). When the curve is deleted, the points & your effect will be deleted, as well.

Make sense?

-lyle

FB_Turbine
09-27-2003, 03:53 AM
Maybe I missed something but can I create new tools? Like a multinull tool or a curve tool that has 2 curves?

markpassion
09-27-2003, 12:31 PM
you can't write your own tools yet. meant to be coming though I think.

Mark

lmilton
09-29-2003, 07:57 PM
Originally posted by FB_Turbine
Maybe I missed something but can I create new tools? Like a multinull tool or a curve tool that has 2 curves?

You can't create tools yet. I was not suggesting that you create a new tool, but use an existing tool.

In case you didn't know, when you initialize your effect, you can choose the type of tool that your effect will use. For example, calling this at S_MODULE_INIT:

fxInitEffectTool(FX_TOOLTYPE_CURVE, 0); //This effect uses a curve as its tool

Will create a curve whenever your effect is created, and your effect will be attatched to this curve. Then inside your O_CREATE, you can create the points you need on that curve... BUT ONLY IF YOUR EFFECT ISN'T BEING LOADED FROM A FILE. Use fxObjectIsLoading to determine if your effect is being loaded.

Le me know if I've been clear...

-lyle

FB_Turbine
09-29-2003, 11:36 PM
Lyle, that answer is clear. I'd really on thought of using null or slider. My problem, is following the development concept as it exists does not really lead me in the direction I originally planned. I think I might need to reevaluate how I plan this to work.

lmilton
10-01-2003, 09:16 AM
Originally posted by FB_Turbine
Lyle, that answer is clear. I'd really on thought of using null or slider. My problem, is following the development concept as it exists does not really lead me in the direction I originally planned. I think I might need to reevaluate how I plan this to work.

Or maybe not.:shrug:

If you only need a couple of nulls for an added level of control, then go 'head. Just create a couple of objectpopups and let the user choose which objects to use; this will allow for more flexibility. Also, you can add a button that will create the Nulls based on user needs. Alternatively, you can automatically create an armature with a couple of handles... it all really depends on the needs of the module.

The one thing you should shy away from is deleting the objects automatically. It may end up causing more problems than you intend to solve.

I hope this was helpful:)

-lyle

CGTalk Moderation
01-15-2006, 05:03 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.