Lightrooom SDK: is view-factory object passed to dialog functions special?

  • 1
  • Question
  • Updated 4 years ago
example:

MyExportFilter.sectionForFilterInDialog( viewFactory, propertyTable )

One can ignore view-factory passed as parameter and use a global view factory created during plugin initialization with no perceivable difference in behavior.

Is the view-factory parameter just a convenience?
Is it OK to use a global view factory everywhere and ignore view-factory parameters? Certainly seems OK, but is it possible to have a problem by doing it? - if so, please elaborate.

Thanks,
Rob
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes

Posted 5 years ago

  • 1
Photo of John R. Ellis

John R. Ellis, Champion

  • 3610 Posts
  • 939 Reply Likes
Good question. You might compare the parameter with the global to see if indeed the same object:

Debug.pauseIf (viewFactory ~= globalViewFactory)

Not the same as an authoritative answer from Adobe (if only it would come), but it might increase your confidence.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
They are not the same - Lr is creating a new view-factory object to pass. I'm guessing such is not necessary (any view factory will create views as well as any other, in any context, or so it seems to me so far), and it's just kinda how it turned out, or keeps options open for future... - dunno.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
I just checked (Lr5.6) - all members of view factory are functions (no data type members), and all functions are the same in all view factory instances.

So, unless I've missed something, all view-factory instances are equivalent/interchangeable.