YOUR ACCOUNT

Login or Register to post new topics or replies
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
The new features are absolutely amazing! That curve editor is really a nice piece of work :-S

I have tested the new scripting features and they seem to work well. However one thing about the blend function design is really annoying: why have a separate function for *each* blendmode and not just an index parameter?

Take a look at the code here:


.. with a simple index the above 11 lines conditional could have been skipped and moreover all blendmodes would be available:
Code
blend(r1,g1,b1,a1, r2,g2,b2,a2, opacity, hdr, BL_MODE)


You could preregister constants for the different modes (BL_NORMAL = 1 etc). If no index is supplied, 1 could be assumed.

(and please please.. don't forget the script editor in V3, it is very annoying that you can't detach/resize/open in new window.. I bet your own programmers did not use it when making example scripts..)
  Details E-Mail
James
James
Posts: 676
Filters: 46
Good suggestion, i haven't tested the new coding options too much just yet but a single index based version would be a good thing to have and would make the code a lot simpler.

I am thinking that if there is a possible chance for rendering optimization using separate functions could be useful though so you could still keep all of those. I think FF could maybe just have both separate functions and a index based version also. smile:D
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
Please FF - if you do not revise the blending function design, could you at least create separate HDR function definitions from non-HDR definitions..

The problem is that the parameter count differs btwn. non-HDR functions and HDR functions, which makes it very impractical.

Consider the following alternative (and much cleaner) script of your blending script example:
Code

function prepare()
   BL_MODE = get_intslider_input(BLENDING_MODE)
   HDR =  (1 == get_checkbox_input(HDR))
   BLENDFUNCTIONS = {
      blend_normal,
      blend_darken,
      blend_multiply,
      blend_color_burn,
      blend_linear_burn,
      blend_lighten,
      blend_screen,
      blend_color_dodge,
      blend_linear_dodge,
      blend_overlay,
      blend_soft_light,
      blend_hard_light,
      blend_vivid_light,
      blend_linear_light,
      blend_difference,
      blend_hue,
      blend_saturation,
      blend_color,
      blend_luminosity
   }
end;

function get_sample(x, y)
   local r, g, b, a = get_sample_map(x, y, BACKGROUND)
   local r2, g2, b2, a2 = get_sample_map(x, y, FOREGROUND)
   local opacity = get_sample_grayscale(x, y, OPACITY)
   return  BLENDFUNCTIONS[BL_MODE](r, g, b, a, r2, g2, b2, a2, opacity, HDR)
end;


Now this a much better alternative compared to the cluttering and inefficient conditional check seen in:


But the darn parameter inconsistency caused by the additional HDR parameter present in some modes, causes the script to either fail on non-HDR modes (as presented above) or fail on HDR modes... smile:evil:

I suggest not mixing things here, so the HDR modes are available as separate functions (since these are really different), i.e.:

blend_normal_hdr
blend_darken_hdr
blend_multiply_hdr
blend_lighten_hdr
blend_linear_dodge_hdr
blend_difference_hdr
blend_hue_hdr
blend_saturation_hdr
blend_color_hdr
blend_luminosity_hdr
  Details E-Mail
GMM
Moderator
Filter Forge, Inc
Posts: 3491
I guess this thread should reside in the Feature Wishlist forum.
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,711 Registered Users
+18 new in 30 days!

153,531 Posts
+36 new in 30 days!

15,347 Topics
+72 new in year!

Create an Account

Online Users Last minute:

20 unregistered users.