How quickly does one learn to write modules?

Started by c2s07, April 04, 2014, 02:14:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

c2s07

Hello,

How long would it take for a complete beginner to learn modules writing, and what programs would I need? I'm a bit curious about this as I like customizing things, and since my preferences sometimes differ from those of others, custom modules for personal use might be the way to go for me. If it takes at least months to learn this, then it's probably not worth the time for me, as the changes I've been thinking of are relatively simple.

I can give you a few examples, and if things like these cannot even be achieved with modules (or scripts), let me know.

1) I'd like to try to re-assign some of the camera buttons to toggle ML features. For example, the top LCD panel light button (or some other button) could quickly toggle the "LV DIGIC peaking / Edge image" effect instead. Can something like this be achieved with modules?

2) Suppose I wanted to customize the arrow/set shortcut pairs to my preferences. For example, the horizontal arrows would control the basic color temperature (K) value, and the vertical arrows would control the green/magenta shift. And while at it, perhaps the SET-button could toggle the "LV crazy colors / extreme chroma" effect. Can something like this be achieved with modules?

a1ex

Changing menu is possible with the scripting engine (both the old PicoC and the proof-of-concept TCC), but right now there's no usable scripting solution.

For now, you can just call the underlying API:


menu_set_value_from_script("Overlay", "Focus Peak", 1);


or, even like this:

menu_set_str_value_from_script("Advanced settings", "Color scheme", "Dark Red");


This reminded me that "Advanced settings" may have to be renamed to something like "Advanced display settings" or something like this. Submenus are in the same namespace as regular menus (so you will find all of them at the top level), and this lets you access any menu or submenu just from its name.

I'll let the others fill in the other details.

dmilligan

Quote from: c2s07 on April 04, 2014, 02:14:32 AM
complete beginner
It depends on what you mean by complete beginner. Do you have any programing experience at all? If not, it will probably take you months just to learn enough C to do something useful. If you are a strong programmer, simply lacking C experience, it shouldn't take you long to learn C. Someone very familiar with C could pick up ML is just a few days probably, at least get something compiled and running. Then it's just matter of pouring through the ML API to find the particular thing you need.

As for the particular things you want to do, keep in mind that not every button is detectable by ML, and it varies by camera model.

The first step is getting the compiler up and running:

Quote from: Audionut on December 11, 2013, 06:07:14 PM
Getting started with development
Getting the code and a development machine up and running.

Easy Coding Tasks.

Safe Hacking Toolbox

Getting started as developer
General discussion in getting started.

Mercurial Tips

Quick Guide and Solutions for VirtualBox

Magic Lantern TODO list

Submitting a pull request all via web browser

Magic Lantern development on Windows - A detailed step-by-step-guide

Beginners Guide to Compiling Magic Lantern

A long list of camera registers

Need help compiling on mac

Using TortoiseHG (GUI) - Working with branches - Creating Pull Request

Marsu42

Quote from: c2s07 on April 04, 2014, 02:14:32 AM
How long would it take for a complete beginner to learn modules writing, and what programs would I need?

If you can get the ml source via mercurial & compile it yourself, then copy/paste the sample module and customize it. These steps are "easy", what might take time is to get to know how to do things you cannot copy/paste from other modules... ML has no core api documentation, you need to look into the core source yourself and see how it's done. If you want to do something really new beyond simple key shortcuts, expect to spend quite a lot of time on it.

Quote from: c2s07 on April 04, 2014, 02:14:32 AM
1) I'd like to try to re-assign some of the camera buttons to toggle ML features.
2) Suppose I wanted to customize the arrow/set shortcut pairs to my preferences.

Indeed it can, I'll upload my hot_keys module shortly that does exactly that :-p though for non-lv only as core ML already has arrow/set shortcuts for lv ... note that a lot of buttons are either unavailable to ML or used by core ML itself, that basically leaves SET and the joystick/arrow buttons for user use.

c2s07

Thanks to everyone so far. :-)

I wouldn't call myself a strong programmer, and I have no experience in C. But I do have some experience in programming, and in fact posting a sample module for me to look at sounds like a good idea, as I've often learned by some taking time to analyze and edit an existing bit of code. At least it's worth a try.

I'll take a look at dmilligan's list while waiting for Marsu42's upload, heh.

Marsu42

Quote from: c2s07 on April 04, 2014, 03:48:44 PM
I wouldn't call myself a strong programmer, and I have no experience in C.

In that case expect some frustration, C isn't really a beginner's language and if you have no clue about pointers and structures you might have a hard time understanding what's going on...

c2s07

I hope you didn't abandon the thought of uploading your hot_keys module yet; I'd still like to take a look at the code, as you made it sound like it might be very close to one of the changes I've been thinking of. I've been reading the code of other modules around here, and it seems it might actually be possible for me to learn to at least edit an existing module, given it's close enough to what I'm aiming for as well. :-)

I know I said I'm not a strong programmer, but I understand the basic logic, and could notice some similarities to what I've dabbled with before.

Marsu42

Quote from: c2s07 on April 05, 2014, 02:33:48 PM
I hope you didn't abandon the thought of uploading your hot_keys module yet

No way, it's my 2nd favorite personal module, I use it every day. It's just that I didn't come around to add a nice gui & menu structure as it does what I want: after pressing a meta-key once or twice link menu/set to toggle various Canon functions (metering, fps, servo, back/front-af, ...) and some ml settings (ettr, dual_iso, auto_iso).

engardeknave


Marsu42

Quote from: engardeknave on April 05, 2014, 08:23:36 PM
I'm extremely interested in this module.

In that case, please lobby with me so that some core dev implements array config vars to modules (just like in the core) as working around this limitation in modules that handles variable sets is a pita :-o

gerk.raisen

 Marsu42, I can't wait to use your hot_keys module  ;)

@alldevelopers
Please add array config vars to modules (just like in the core) to make this happen!

Thanks.

c2s07

I knew I recalled some talk about a hotkeys module on these forums... it's been almost exactly a year, too.

Although I haven't been watching these forums too closely during the last several months, I don't think I've spotted any finished modules or other updates allowing custom hotkey assignments to any ML function. As I'm still interested in this, I'd be grateful to hear if there's been any progress.