Page 1 of 3

Spacers between parameters

Posted: Thu Jan 07, 2016 08:58
by hive8
I wrote a quick plugin so i can position the input texture 4 times one the composition. I can just apply this to a clip, layer or whole composition without using 4 layers. I was wondering if it is possible to add spaces in between the parameters. So it does not become so cluttered, please let me know any suggestions.

Find attached a screenshot.

I will be adding more functions to it later, like cropping, rotation, anchor point movements of the texture only, zooming of the texture only. I just wrote this up in an hour quick as a test, currently WIN only till i get my OSX machine from repair back.

Re: Spacers between parameters

Posted: Thu Jan 07, 2016 15:12
by Joris
Nice idea!

I'm afraid there's no extra UI elements to use.

I made a very similar plugin about 2 years ago (except it did 24 copies and had 10 params each, for a whopping total of 240 and then some params), and we ran into the same problem. We went with a string input param at the beginning of the block, showing the name of the copy, to help show the user where he or she was in the list.

It worked, but in the end it was still a workaround. Having this many parameters is just not a good way to work in a plugin for a variety of reasons.

Re: Spacers between parameters

Posted: Fri Jan 08, 2016 07:48
by hive8
Thank you for the quick reply, could you give me a quick example of how to add that string parameter between 2 blocks of sliders.

I am assuming i will need to use the

SetParamInfo(FFPARAM_S1MOVEX, "S1 Move X", FF_TYPE_STANDARD, 0.5f);
s1_moveX = 1.0f;

With zero values, any help is appreciated ;)

Re: Spacers between parameters

Posted: Fri Jan 08, 2016 10:06
by Joris
Not sure what you mean by zero values, but a string param is defined by FF_TYPE_TEXT

SetParamInfo is overloaded, so when you call it with a char pointer and FF_TYPE_TEXT, it knows it needs to create a string param.

Code: Select all

/// This method is called by a plugin subclass, derived from this class, to specify name, type, and default 
	/// value of the plugin parameter whose index is passed as parameter to the method. This method is usually 
	/// called when a plugin object is instantiated (i.e., in the plugin subclass contructor). This version of 
	/// the SetParamInfo function (DefaultValue of type char*) should be called for plugin parameters of type text.
	///
	/// \param	dwIndex			Index of the plugin parameter whose data are specified.
	///							It should be in the range [0, Number of plugin parameters).
	/// \param	pchName			A string containing the name of the plugin parameter.
	///							According to the FreeFrame specification it should be at most 16 1-byte ASCII 
	///							characters long. Longer strings will be truncated at the 16th character.
	/// \param	dwType			The type of the plugin parameter. Codes for allowed types are defined in FreeFrame.h.
	/// \param	pchDefaultValue	A string to be used as the default value of the plugin parameter.
	void SetParamInfo(unsigned int index, const char* pchName, unsigned int type, const char* pchDefaultValue);

Re: Spacers between parameters

Posted: Fri Jan 08, 2016 10:14
by Joris
Btw, in your example, you set the default value of the param to 0.5, and then you initialise the variable probably connected to the param with 1.0.

This means that when you first run the plugin, the slider and the actual value won't match. It's not really bad to do this, because Resolume reads out the params on every frame, so it will update the variable after the first frame of rendering.

Other software might be smarter in their FFGL implementation, and only read out values when they change. So that could lead to mismatching values until you actually change the slider.

Hope that helps!

Re: Spacers between parameters

Posted: Sat Jan 09, 2016 02:29
by hive8
Thank you for pointing that out, I fixed those.
I noticed one little problem, when i put the plugin on a layer, clip or composition all works as it supposed too, but when i exit resolume, resolume crashes. I ran the plugin in the delphihost and it gave me one error

DeInstantiate Plugin ERROR
DeInitalise Plugin OK

Any idea what that could be?

//unbind the texture
glBindTexture(GL_TEXTURE_2D, 0);

//disable texturemapping
glDisable(GL_TEXTURE_2D);

return FF_SUCCESS;


Also could you give me a example for the text only param

right now i have this

.h file
//Others
char m_ScreenName;

.cpp file
#define FFPARAM_SCREEN (16)

SetParamInfo(FFPARAM_SCREEN, "Screen 1", FF_TYPE_TEXT, "");
m_ScreenName;

Re: Spacers between parameters

Posted: Sat Jan 09, 2016 15:40
by Joris
Any idea what that could be?
Hard to say without seeing the rest of your code. Is there actually a bound texture to unbind at that point?
Also could you give me a example for the text only param
What you have should work. I think a text param expects you to at least implement GetTextParameter, otherwise it will try to call it and crash. I don't think implementing SetTextParameter is actually necessarry.

Personally, I would call the param name "Name 1", and then give it the value "Screen 1". That way you make a clear distinction between the name of the param and the value of the param (ie what it does and what it's set to). But I'm pedantic like that ;)

The function expects you to work with a char pointer, and you're working with a char. But if you're not actually using the text anywhere, there's no need for the variable m_ScreenName at all. That variable is only used to get the data from the param and make it accessible to the rest of your code.

Re: Spacers between parameters

Posted: Sat Jan 09, 2016 15:46
by Joris
Is there actually a bound texture to unbind at that point?
Scratch that. That's silly. A call to glBindTexture should always work. I think ;)

It's kind of late to only unbind your texture when the plugin gets cleaned up. That means you're using GPU memory, even when the plugin is not visible. With a lot of instances of the plugin, that can add up real quick.

Ideally, you would bind and unbind the incoming texture at the beginning and end of the draw call.

Re: Spacers between parameters

Posted: Mon Jan 11, 2016 20:30
by hive8
I think version 1.000 is finished... :)

More to come in the next version probably end of week
Can someone test for me and see if it works on other machines, win only as of now till the mac comes back.

Suggestions for more features are welcome, please let me know and I will try to add them.

Thx Joris for the help i got everything figured out :)

To note for this version the string to show the pixels and % on the slider is currently hard coded to a resolution of 1920 x 1080 will change later.

Re: Spacers between parameters

Posted: Tue Jan 12, 2016 08:50
by damstraversaz
great ! I will try it as soon as possible