Notifications
Clear all

[Closed] Callback speed question

Hello. Is there any way to execute parts of a function only once at the beginning or the end of a callbacks? I’ll use the following example to clarify what I mean:


Var = false
Hide_Array = #()
fn Hide_fn sel =
	(
	Var = true
	if Var == true then append Hide_Array sel
	Var = false
	)
callbacks.addScript #nodeHide Hide_fn(callbacks.notificationParam())" id:#Auto_Hide

If I hide 50 objects it executes the first and third line of the function 50 times. I am looking for a way for when I hide the objects, it executes the first line only once at the beginning before any hiding begins, then executes the 2nd line for each object, and then executes the 3rd when finished only once.
Being able to do this would increase the speed of some callback functions I’ve created, but I can’t think of a way of doing this. Any help would be greatly appreciated

1 Reply

use Node Event Callbacks instead general callbacks. see the help for details and examples. search this forum for many examples