Page MenuHome

unreachable code in wm_keymap.c
Closed, ResolvedPublic

Description

I could be wrong but it appears that line 1521 in the 2.71 source (1561 of the current on GIT) is unreachable in
/** \file blender/windowmanager/intern/wm_keymap.c

  • \ingroup wm *
  • Configurable key-maps - add/remove/find/compare/patch... */
	else if (strstr(opname, "PAINT_OT")) {
		
		/* check for relevant mode */
		switch (CTX_data_mode_enum(C)) {
			case OB_MODE_WEIGHT_PAINT:
				km = WM_keymap_find_all(C, "Weight Paint", 0, 0);
				break;
			case OB_MODE_VERTEX_PAINT:
				km = WM_keymap_find_all(C, "Vertex Paint", 0, 0);
				break;
			case OB_MODE_TEXTURE_PAINT:
				km = WM_keymap_find_all(C, "Image Paint", 0, 0);
				break;
		}
	}
	/* Paint Face Mask */
	else if (strstr(opname, "PAINT_OT_face_select")) {
		km = WM_keymap_find_all(C, "Face Mask", sl->spacetype, 0);
	}

this should probably be

	/* Paint Face Mask */
	else if (strstr(opname, "PAINT_OT_face_select")) {
		km = WM_keymap_find_all(C, "Face Mask", sl->spacetype, 0);
	}
	else if (strstr(opname, "PAINT_OT")) {
		
		/* check for relevant mode */
		switch (CTX_data_mode_enum(C)) {
			case OB_MODE_WEIGHT_PAINT:
				km = WM_keymap_find_all(C, "Weight Paint", 0, 0);
				break;
			case OB_MODE_VERTEX_PAINT:
				km = WM_keymap_find_all(C, "Vertex Paint", 0, 0);
				break;
			case OB_MODE_TEXTURE_PAINT:
				km = WM_keymap_find_all(C, "Image Paint", 0, 0);
				break;
		}
	}

Revisions and Commits

Event Timeline

Greg Dickson (yardie) raised the priority of this task from to 90.
Greg Dickson (yardie) updated the task description. (Show Details)
Greg Dickson (yardie) edited a custom field.

Good catch, thanks! :)

Bastien Montagne (mont29) lowered the priority of this task from 90 to Normal.Sep 13 2014, 3:51 PM

I was going to say while your in there couldn't the following work the same way.
I am still getting my head around the blender context thing

	else if (strstr(opname, "OBJECT_OT")) {
		/* exception, this needs to work outside object mode too */
		if (strstr(opname, "OBJECT_OT_mode_set"))
			km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
		else
			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
	}

but may be next time your around there

Yes it could, but current code is working too afaik, so no real need to change it here?

OK Cool
Thanks heaps for the quick fix.
I am trying to duplicate this in python (its not callable in anyway directly from python is it?)

No, this is not accessible from py currently :/

Don't be sad :)
That's the cool thing about Blender/Python.
If you want it you can always make it. :D
Peeling the onion is the bit that makes me cry a bit.