Notifications
Clear all

[Closed] Protecting dotNet component events from GC in max 2009

Ah… hmm…

So how about if on Open, I call a function that creates the buttons, and then that adds them into an array/the FlowLayoutPanel?

Would I be able to do the local var at the top of that function, and then create/add the buttons?

Or could I declare a global and keep replacing that global var with each button as they are created?

Thanks!

1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

you don’t need to declare the array as global. it’s too much. just declare the array in local scope of the rollout.

So I could put the local in my open event here?

fn loadButtons rolloutPanel iniPath = 
(
	local thumbArray = #()
	--Creates/Adds Buttons
	append thumbArray btndragdrop
	rolloutPanel.controls.addrange thumbArray
)

on turboTools_Roll open do
(
	loadButtons (turboTools_Roll.flp) ((pathConfig.GetDir #MaxData)+"Scripts\	urboTools\	urboTools_ModelLayout.ini")
)
1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

no.


 rollout r ''''
 (
   ... <panel control>
   local arr = #()
   on r open do 
(
  append arr <make button>
  panel.controls.addrange arr
)
 )
 

writing from cell phone. sorry

Ah… hmm… With my current code setup, I have to use functions/would rather, to cut down on code and make things cleaner.

Also, I have differen’t buttons calling the function, to clear the FlowPanel and load in new buttons via ini files.

So I guess I may have to stick to the lifetimecontrol unless there is another way. Since I’m changing the buttons often and not only settings them on rollout open.

4 Replies
(@denist)
Joined: 2 years ago

Posts: 0

no, no, no… people who added lifetimecontrol just fog the problem. there are no places for me where lifetimecontrol really helped me.

(@panayot)
Joined: 2 years ago

Posts: 0

Lifetimecontrol not added correctly to Max? Just curious.

(@denist)
Joined: 2 years ago

Posts: 0

it’s added correctly. but it doesn’t solve all problems. dotnet object in max is not a member of max family. it’s just a pointer to protected piece of memory. lifetimecontrol just does protect the marked piece. but what does prevent you from do it yourself?

(@panayot)
Joined: 2 years ago

Posts: 0

That’s clear and agree, I just was not sure what you mean above.
Thanks for the reply!
Now I try to remember why I lose trust to custom protection

Yeah, I know it’s kind of a cheap method to use… I’d rather not, but it’s not a huge issue right now. But it would be nice to support max 2008 +.

I’ve tried adding the eventhandlers after adding them to the rollout when its open, but that didn’t fix the issue either.

1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

dotnet in max 2008 is mostly broken. i’ve tired to fight with it. i don’t develop any new tool for versions before max 2009.

Yeah, and now since Max 2012 will be out soon :D, I think alot of people might switch to that.

Their performance seems to be leaps and bounds better than the previous versions, and the UV tools seem quite nice. At least alot better than what is there now.

Page 2 / 2