Author Topic: Tip: Adding effects to the keybindings.xml file for single key effect generation  (Read 3053 times)

Offline flyinverted

  • Administrator
  • Hero Member
  • *****
  • Posts: 756
    • View Profile
Adding predefined effects to your xlights_keybindings.xml file

1. Create an effect and place it on a model.
2. Highlight that cell and COPY via control+c (WIn) Cmd+C (mac)
3. Open Notepad++  and paste the effect into a new file

Example of the pasted effect:

Fire   

E_CHECKBOX_Fire_GrowFire=0,E_SLIDER_Fire_Height=43,E_SLIDER_Fire_HueShift=73,T_CHECKBOX_FitToTime=0,T_CHECKBOX_LayerMorph=0,T_CHECKBOX_OverlayBkg=0,T_CHOICE_LayerMethod=Effect1,T_SLIDER_EffectLayerMix=0,T_SLIDER_Speed=11,T_TEXTCTRL_Fadein=0.00,T_TEXTCTRL_Fadeout=0.00,C_BUTTON_Palette1=#FF0000,C_BUTTON_Palette2=#00FF00,C_BUTTON_Palette3=#0000FF,C_BUTTON_Palette4=#FFFFFF,C_BUTTON_Palette5=#8000FF,C_BUTTON_Palette6=#000000,C_CHECKBOX_Palette1=1,C_CHECKBOX_Palette2=0,C_CHECKBOX_Palette3=1,C_CHECKBOX_Palette4=1,C_CHECKBOX_Palette5=0,C_CHECKBOX_Palette6=0,C_SLIDER_Brightness=100,C_SLIDER_Contrast=0,C_SLIDER_SparkleFrequency=0


4. Close Nutcracker (VERY IMPORTANT)
5. Open the xlights_keybinding.xml file with Notepad ++
6. Add a new hotkey line between the <keybindings> </keybindings> tags
   Example to use the number 5 for the new Fire preset
<keybinding key="5" type="EFFECT" effect="Fire"></keybinding>

7. From the new file created copy the pasted text starting at the E_Checkbox all the way to the end.
8. Paste that in the new line created in step 6. Make sure you paste between the  > < tags
   Example:   "Fire"> PASTE HERE </keybinding>

Full example:
<keybinding key="5" type="EFFECT"

effect="Fire">E_CHECKBOX_Fire_GrowFire=0,E_SLIDER_Fire_Height=43,E_SLIDER_Fire_HueShift=73,T_CHECKBOX_FitToTime=0,T_CHECKBOX_LayerMorph=0,T_CHECKBOX_OverlayBkg=0,T_CHOICE_LayerMethod=Effect1,T_SLIDER_EffectLayerMix=0,T_SLIDER_Speed=11,T_TEXTCTRL_Fadein=0.00,T_TEXTCTRL_Fadeout=0.00   
C_BUTTON_Palette1=#FF0000,C_BUTTON_Palette2=#00FF00,C_BUTTON_Palette3=#0000FF,C_BUTTON_Palette4=#FFFFFF,C_BUTTON_Palette5=#8000FF,C_BUTTON_Palette6=#000000,C_CHECKBOX_Palette1=1,C_CHECKBOX_Palette2=0,C_CHECKBOX_Palette3=1,C_CHECKBOX_Palette4=1,C_CHECKBOX_Palette5=0,C_CHECKBOX_Palette6=0,C_SLIDER_Brightness=100,C_SLIDER_Contrast=0,C_SLIDER_SparkleFrequency=0</keybinding>

Make sure there are no spaces in that line and there's a comma between each setting.

9. SAVE the xlights_keybindings.xml file
10. Open xLights, open a sequence and highlight a cell, press 5 to see the fire effect you saved appear.
Steve Giron
Maricopa County, AZ
xLights user with a boat-load of channels.

Do not ask to know all the answers, but ask to understand the question.

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
FYI I think I broke key bindings in version 4.0.19.  When I was trying to add the multi effect copy/paste I changed something I didn't realize was also used by the key bindings so Dan had to fix it this morning.  So they won't work till 4.0.20.

Offline flyinverted

  • Administrator
  • Hero Member
  • *****
  • Posts: 756
    • View Profile
Yeah I saw Dan fixed that and closed my ticket. ABC  Always Be Closing!
Steve Giron
Maricopa County, AZ
xLights user with a boat-load of channels.

Do not ask to know all the answers, but ask to understand the question.

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Yeah I keep thinking we need to develop a suite of regression tests that we perform before putting out a new release so we could catch something like this before it goes out.

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Yeah I never saw a ticket so it must have been opened and closed in between me monitoring the list.  I guess I'll turn issue notifications back on since the surge of new issues seems to have slowed down.

Offline jlowe

  • Newbie
  • *
  • Posts: 27
    • View Profile
I'm trying to work on a custom keybindings file. I'm planning to use a device with buttons to send shortcut keys to the computer. I'd like to set some shortcuts that are even basic effects, but with a set color.

For example, a ramp up effect that is colored red, a ramp up effect colored blue, etc.

Here's the ramp up for red:
Code: [Select]
<keybinding key="4" type="EFFECT" effect="On">
E_TEXTCTRL_Eff_On_Start=0 C_BUTTON_Palette1=#FFFFFF,C_BUTTON_Palette2=#FF0000,C_BUTTON_Palette3=#00FF00,C_BUTTON_Palette4=#0000FF,C_BUTTON_Palette5=#FFFF00,C_BUTTON_Palette6=#000000,C_BUTTON_Palette7=#00FFFF,C_BUTTON_Palette8=#FF00FF,C_CHECKBOX_Palette2=1 725 1225 7 725 1 1 0 100
</keybinding>

The problem I'm having is, if I select multiple cells, it will not insert. It only does it for a single cell. Is there a way to adjust it so that I will be able to select multiple cells and apply the effect to all those selected by simply pressing the shortcut key?
« Last Edit: May 22, 2016, 01:24:33 PM by jlowe »

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
A couple problems.  You don't want all those codes on the end because that is info describing the start and end timing, source cell columns, etc. and it will just mess things up.  Second is you can't have that line feed at the end of the line before the </keybinding> tag.  That return character causes the code to believe there are two paste items instead of one when it does a split on return chaacters because thats the separator character for multiple effect pasting and we don't allow a multiple effect paste for a range selection.  I got it to work with this code:

Code: [Select]
  <keybinding key="4" type="EFFECT" effect="On">E_TEXTCTRL_Eff_On_Start=0 C_BUTTON_Palette1=#FFFFFF,C_BUTTON_Palette2=#FF0000,C_BUTTON_Palette3=#00FF00,C_BUTTON_Palette4=#0000FF,C_BUTTON_Palette5=#FFFF00,C_BUTTON_Palette6=#000000,C_BUTTON_Palette7=#00FFFF,C_BUTTON_Palette8=#FF00FF,C_CHECKBOX_Palette4=1</keybinding>

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Also remember when using this to paste to multiple cells is will place one effect for the entire duration if you select Paste By Time whereas Paste By Cell will insert a copy in every cell.

Offline jlowe

  • Newbie
  • *
  • Posts: 27
    • View Profile
Ahh, thanks for the tips and the quick reply. I'm away from my computer right now, but I'll try it out later. Thanks!
 
Edit: That worked out great! Thanks again.
« Last Edit: May 23, 2016, 05:43:55 PM by jlowe »