/* return 0 if not OK */
static int ed_marker_move_init(bContext *C, wmOperator *op)
{
	ListBase *markers = ED_context_get_markers(C);
	MarkerMove *mm;
	TimeMarker *marker;
	int totmark = 0;
	int a;

	if (markers == NULL) return 0;
	
	for (marker = markers->first; marker; marker = marker->next)
		if (marker->flag & SELECT) totmark++;
	
	if (totmark == 0) return 0;
	
	op->customdata = mm = MEM_callocN(sizeof(MarkerMove), "Markermove");
	mm->slink = CTX_wm_space_data(C);
	mm->markers = markers;
	mm->oldframe = MEM_callocN(totmark * sizeof(int), "MarkerMove oldframe");

	initNumInput(&mm->num);
	mm->num.idx_max = 0; /* one axis */
	mm->num.flag |= NUM_NO_FRACTION;
	mm->num.increment = 1.0f;
	
	for (a = 0, marker = markers->first; marker; marker = marker->next) {
		if (marker->flag & SELECT) {
			mm->oldframe[a] = marker->frame;
			a++;
		}
	}
	
	return 1;
}
Beispiel #2
0
/* Init handling for space-conversion function (from passed-in parameters) */
void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
{
	ScrArea *sa = CTX_wm_area(C);
	ARegion *ar = CTX_wm_region(C);
	
	/* zero out the storage (just in case) */
	memset(r_gsc, 0, sizeof(GP_SpaceConversion));
	unit_m4(r_gsc->mat);
	
	/* store settings */
	r_gsc->sa = sa;
	r_gsc->ar = ar;
	r_gsc->v2d = &ar->v2d;
	
	/* init region-specific stuff */
	if (sa->spacetype == SPACE_VIEW3D) {
		wmWindow *win = CTX_wm_window(C);
		Scene *scene = CTX_data_scene(C);
		View3D *v3d = (View3D *)CTX_wm_space_data(C);
		RegionView3D *rv3d = ar->regiondata;
		
		/* init 3d depth buffers */
		view3d_operator_needs_opengl(C);
		
		view3d_region_operator_needs_opengl(win, ar);
		ED_view3d_autodist_init(scene, ar, v3d, 0);
		
		/* for camera view set the subrect */
		if (rv3d->persp == RV3D_CAMOB) {
			ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &r_gsc->subrect_data, true); /* no shift */
			r_gsc->subrect = &r_gsc->subrect_data;
		}
	}
}
Beispiel #3
0
void gpencil_panel_standard_header(const bContext *C, Panel *pa)
{
	PointerRNA ptr;
	RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &ptr);

	uiItemR(pa->layout, &ptr, "show_grease_pencil", 0, "", ICON_NONE);
}
Beispiel #4
0
static int action_pushdown_exec(bContext *C, wmOperator *op)
{
	SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
	AnimData *adt = ED_actedit_animdata_from_context(C);
	
	/* Do the deed... */
	if (adt) {
		/* Perform the pushdown operation
		 * - This will deal with all the AnimData-side usercounts
		 */
		if (action_has_motion(adt->action) == 0) {
			/* action may not be suitable... */
			BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
			return OPERATOR_CANCELLED;
		}
		else {
			/* action can be safely added */
			BKE_nla_action_pushdown(adt);
		}
		
		/* Stop displaying this action in this editor
		 * NOTE: The editor itself doesn't set a user...
		 */
		saction->action = NULL;
	}
	
	/* Send notifiers that stuff has changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
	return OPERATOR_FINISHED;
}
Beispiel #5
0
static PointerRNA rna_Context_space_data_get(PointerRNA *ptr)
{
	bContext *C= (bContext*)ptr->data;
	PointerRNA newptr;
	RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &newptr);
	return newptr;
}
Beispiel #6
0
/* Criteria:
 *  1) There must be an dopesheet/action editor, and it must be in a mode which uses actions 
 *  2) The associated AnimData block must not be in tweakmode
 */
static int action_stash_create_poll(bContext *C)
{
	if (ED_operator_action_active(C)) {
		AnimData *adt = ED_actedit_animdata_from_context(C);
		
		/* Check tweakmode is off (as you don't want to be tampering with the action in that case) */
		/* NOTE: unlike for pushdown, this operator needs to be run when creating an action from nothing... */
		if (adt) {
			if (!(adt->flag & ADT_NLA_EDIT_ON))
				return true;
		}
		else {
			/* There may not be any action/animdata yet, so, just fallback to the global setting
			 * (which may not be totally valid yet if the action editor was used and things are 
			 * now in an inconsistent state)
			 */
			SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
			Scene *scene = CTX_data_scene(C);
			
			if (!(scene->flag & SCE_NLA_EDIT_ON)) {
				/* For now, actions are only for the active object, and on object and shapekey levels... */
				return ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY);
			}
		}
	}
	
	/* something failed... */
	return false;
}
Beispiel #7
0
/* Criteria:
 *  1) There must be an dopesheet/action editor, and it must be in a mode which uses actions...
 *        OR
 *     The NLA Editor is active (i.e. Animation Data panel -> new action)
 *  2) The associated AnimData block must not be in tweakmode
 */
static int action_new_poll(bContext *C)
{
	Scene *scene = CTX_data_scene(C);
	
	/* Check tweakmode is off (as you don't want to be tampering with the action in that case) */
	/* NOTE: unlike for pushdown, this operator needs to be run when creating an action from nothing... */	
	if (ED_operator_action_active(C)) {
		SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
		Object *ob = CTX_data_active_object(C);
		
		/* For now, actions are only for the active object, and on object and shapekey levels... */
		if (saction->mode == SACTCONT_ACTION) {
			/* XXX: This assumes that actions are assigned to the active object in this mode */
			if (ob) {
				if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0)
					return true;
			}
		}
		else if (saction->mode == SACTCONT_SHAPEKEY) {
			Key *key = BKE_key_from_object(ob);
			if (key) {
				if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0)
					return true;
			}
		}
	}
	else if (ED_operator_nla_active(C)) {
		if (!(scene->flag & SCE_NLA_EDIT_ON)) {
			return true;
		}
	}
	
	/* something failed... */
	return false;
}
Beispiel #8
0
/* return 0 if not OK */
static int ed_marker_move_init(bContext *C, wmOperator *op)
{
	ListBase *markers= context_get_markers(C);
	MarkerMove *mm;
	TimeMarker *marker;
	int totmark=0;
	int a;

	if(markers == NULL) return 0;
	
	for (marker= markers->first; marker; marker= marker->next)
		if (marker->flag & SELECT) totmark++;
	
	if (totmark==0) return 0;
	
	op->customdata= mm= MEM_callocN(sizeof(MarkerMove), "Markermove");
	mm->slink= CTX_wm_space_data(C);
	mm->markers= markers;
	mm->oldframe= MEM_callocN(totmark*sizeof(int), "MarkerMove oldframe");
	
	for (a=0, marker= markers->first; marker; marker= marker->next) {
		if (marker->flag & SELECT) {
			mm->oldframe[a]= marker->frame;
			a++;
		}
	}
	
	return 1;
}
Beispiel #9
0
static int action_unlink_poll(bContext *C)
{
	if (ED_operator_action_active(C)) {
		SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
		AnimData *adt = ED_actedit_animdata_from_context(C);
		
		/* Only when there's an active action, in the right modes... */
		if (saction->action && adt)
			return true;
	}
	
	/* something failed... */
	return false;
}
Beispiel #10
0
static int action_stash_create_exec(bContext *C, wmOperator *op)
{
	SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
	AnimData *adt = ED_actedit_animdata_from_context(C);
	
	/* Check for no action... */
	if (saction->action == NULL) {
		/* just create a new action */
		bAction *action = action_create_new(C, NULL);
		actedit_change_action(C, action);
	}
	else if (adt) {
		/* Perform stashing operation */
		if (action_has_motion(adt->action) == 0) {
			/* don't do anything if this action is empty... */
			BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
			return OPERATOR_CANCELLED;
		}
		else {
			/* stash the action */
			if (BKE_nla_action_stash(adt)) {
				bAction *new_action = NULL;
				
				/* create new action not based on the old one (since the "new" operator already does that) */
				new_action = action_create_new(C, NULL);
				
				/* The stash operation will remove the user already,
				 * so the flushing step later shouldn't double up
				 * the usercount fixes. Hence, we must unset this ref
				 * first before setting the new action.
				 */
				saction->action = NULL;
				actedit_change_action(C, new_action);
			}
			else {
				/* action has already been added - simply warn about this, and clear */
				BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
				actedit_change_action(C, NULL);
			}
		}
	}
	
	/* Send notifiers that stuff has changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
	return OPERATOR_FINISHED;
}
Beispiel #11
0
/* return 0 if not OK */
static bool ed_marker_move_init(bContext *C, wmOperator *op)
{
	Scene *scene = CTX_data_scene(C);
	ListBase *markers = ED_context_get_markers(C);
	MarkerMove *mm;
	TimeMarker *marker;
	int a, totmark;

	if (markers == NULL) {
		return false;
	}

	for (totmark = 0, marker = markers->first; marker; marker = marker->next) {
		if (marker->flag & SELECT) {
			totmark++;
		}
	}

	if (totmark == 0) {
		return false;
	}

	op->customdata = mm = MEM_callocN(sizeof(MarkerMove), "Markermove");
	mm->slink = CTX_wm_space_data(C);
	mm->markers = markers;
	mm->oldframe = MEM_callocN(totmark * sizeof(int), "MarkerMove oldframe");

	initNumInput(&mm->num);
	mm->num.idx_max = 0; /* one axis */
	mm->num.val_flag[0] |= NUM_NO_FRACTION;
	mm->num.unit_sys = scene->unit.system;
	/* No time unit supporting frames currently... */
	mm->num.unit_type[0] = ed_marker_move_use_time(mm) ? B_UNIT_TIME : B_UNIT_NONE;

	for (a = 0, marker = markers->first; marker; marker = marker->next) {
		if (marker->flag & SELECT) {
			mm->oldframe[a] = marker->frame;
			a++;
		}
	}

	return true;
}
Beispiel #12
0
/* Criteria:
 *  1) There must be an dopesheet/action editor, and it must be in a mode which uses actions 
 *  2) There must be an action active
 *  3) The associated AnimData block must not be in tweakmode
 */
static int action_pushdown_poll(bContext *C)
{
	if (ED_operator_action_active(C)) {
		SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
		AnimData *adt = ED_actedit_animdata_from_context(C);
		
		/* Check for AnimData, Actions, and that tweakmode is off */
		if (adt && saction->action) {
			/* NOTE: We check this for the AnimData block in question and not the global flag,
			 *       as the global flag may be left dirty by some of the browsing ops here.
			 */
			if (!(adt->flag & ADT_NLA_EDIT_ON))
				return true;
		}
	}
	
	/* something failed... */
	return false;
}
Beispiel #13
0
/* Change the active action used by the action editor */
static void actedit_change_action(bContext *C, bAction *act)
{
	bScreen *screen = CTX_wm_screen(C);
	SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
	
	PointerRNA ptr, idptr;
	PropertyRNA *prop;
	
	/* create RNA pointers and get the property */
	RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, saction, &ptr);
	prop = RNA_struct_find_property(&ptr, "action");
	
	/* NOTE: act may be NULL here, so better to just use a cast here */
	RNA_id_pointer_create((ID *)act, &idptr);
	
	/* set the new pointer, and force a refresh */
	RNA_property_pointer_set(&ptr, prop, idptr);
	RNA_property_update(C, &ptr, prop);
}
Beispiel #14
0
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
{
	ScrArea *sa= CTX_wm_area(C);
	SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
	
	if(sfile->params) {
		int idx = sfile->params->active_file;
		int numfiles = filelist_numfiles(sfile->files);
		if ( (0<=idx) && (idx<numfiles) ) {
			struct direntry *file= filelist_file(sfile->files, idx);
			filelist_select_file(sfile->files, idx, FILE_SEL_ADD, EDITING_FILE, CHECK_ALL);
			BLI_strncpy(sfile->params->renameedit, file->relname, FILE_MAXFILE);
			sfile->params->renamefile[0]= '\0';
		}
		ED_area_tag_redraw(sa);
	}
	
	return OPERATOR_FINISHED;

}
Beispiel #15
0
static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
{
	char newname[FILE_MAX + 12];
	char orgname[FILE_MAX + 12];
	char filename[FILE_MAX + 12];
	SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
	ARegion *ar = CTX_wm_region(C);

	BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
	BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
	BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);

	if (strcmp(orgname, newname) != 0) {
		if (!BLI_exists(newname)) {
			BLI_rename(orgname, newname);
			/* to make sure we show what is on disk */
			ED_fileselect_clear(C, sfile);
		}

		ED_region_tag_redraw(ar);
	}
}
Beispiel #16
0
/* Helper function to find the active AnimData block from the Action Editor context */
AnimData *ED_actedit_animdata_from_context(bContext *C)
{
	SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
	Object *ob = CTX_data_active_object(C);
	AnimData *adt = NULL;
	
	/* Get AnimData block to use */
	if (saction->mode == SACTCONT_ACTION) {
		/* Currently, "Action Editor" means object-level only... */
		if (ob) {
			adt = ob->adt;
		}
	}
	else if (saction->mode == SACTCONT_SHAPEKEY) {
		Key *key = BKE_key_from_object(ob);
		if (key) {
			adt = key->adt;
		}
	}
	
	return adt;
}
static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
{
	SpaceLink *sl = CTX_wm_space_data(C);
	SpaceType *st = NULL;
	uiLayout *col;
	const char *context = CTX_data_mode_string(C);
	
	if (sl)
		st = BKE_spacetype_from_id(sl->spacetype);
	
	if (st && st->toolshelf.first) {
		CustomTool *ct;
		
		for (ct = st->toolshelf.first; ct; ct = ct->next) {
			if (STREQLEN(context, ct->context, OP_MAX_TYPENAME)) {
				col = uiLayoutColumn(pa->layout, true);
				uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
			}
		}
	}
	col = uiLayoutColumn(pa->layout, true);
	uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files");
}
Beispiel #18
0
/* draw grease pencil */
void draw_image_grease_pencil(bContext *C, short onlyv2d)
{
	/* draw in View2D space? */
	if (onlyv2d) {
		/* assume that UI_view2d_ortho(C) has been called... */
		SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
		void *lock;
		ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
		
		/* draw grease-pencil ('image' strokes) */
		//if (sima->flag & SI_DISPGP)
			draw_gpencil_2dimage(C, ibuf);

		ED_space_image_release_buffer(sima, lock);
	}
	else {
		/* assume that UI_view2d_restore(C) has been called... */
		//SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
		
		/* draw grease-pencil ('screen' strokes) */
		//if (sima->flag & SI_DISPGP)
			draw_gpencil_view2d(C, 0);
	}
}
static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
	Main *bmain = CTX_data_main(C);
	Scene *scene = CTX_data_scene(C);
	SpaceSeq *sseq = (SpaceSeq *) CTX_wm_space_data(C);
	ARegion *ar = CTX_wm_region(C);
	ImBuf *ibuf = sequencer_ibuf_get(bmain, scene, sseq, CFRA, 0);
	ImageSampleInfo *info = op->customdata;
	float fx, fy;
	
	if (ibuf == NULL) {
		IMB_freeImBuf(ibuf);
		info->draw = 0;
		return;
	}

	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);

	fx += (float) ibuf->x / 2.0f;
	fy += (float) ibuf->y / 2.0f;

	if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
		const float *fp;
		unsigned char *cp;
		int x = (int) fx, y = (int) fy;

		info->x = x;
		info->y = y;
		info->draw = 1;
		info->channels = ibuf->channels;

		info->colp = NULL;
		info->colfp = NULL;
		
		if (ibuf->rect) {
			cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);

			info->col[0] = cp[0];
			info->col[1] = cp[1];
			info->col[2] = cp[2];
			info->col[3] = cp[3];
			info->colp = info->col;

			info->colf[0] = (float)cp[0] / 255.0f;
			info->colf[1] = (float)cp[1] / 255.0f;
			info->colf[2] = (float)cp[2] / 255.0f;
			info->colf[3] = (float)cp[3] / 255.0f;
			info->colfp = info->colf;

			copy_v4_v4(info->linearcol, info->colf);
			IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);

			info->color_manage = true;
		}
		if (ibuf->rect_float) {
			fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));

			info->colf[0] = fp[0];
			info->colf[1] = fp[1];
			info->colf[2] = fp[2];
			info->colf[3] = fp[3];
			info->colfp = info->colf;

			/* sequencer's image buffers are in non-linear space, need to make them linear */
			copy_v4_v4(info->linearcol, info->colf);
			BKE_sequencer_pixel_from_sequencer_space_v4(scene, info->linearcol);

			info->color_manage = true;
		}
	}
	else {
		info->draw = 0;
	}

	IMB_freeImBuf(ibuf);
	ED_area_tag_redraw(CTX_wm_area(C));
}
Beispiel #20
0
/* Needs to be kept up to date with Keymap and Operator naming */
wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
{
	wmKeyMap *km=NULL;
	SpaceLink *sl = CTX_wm_space_data(C);
	
	/* Window */
	if (strstr(opname, "WM_OT")) {
		km = WM_keymap_find_all(C, "Window", 0, 0);
	}
	/* Screen */
	else if (strstr(opname, "SCREEN_OT")) {
		km = WM_keymap_find_all(C, "Screen", 0, 0);
	}
	/* Grease Pencil */
	else if (strstr(opname, "GPENCIL_OT")) {
		km = WM_keymap_find_all(C, "Grease Pencil", 0, 0);
	}
	/* Markers */
	else if (strstr(opname, "MARKER_OT")) {
		km = WM_keymap_find_all(C, "Markers", 0, 0);
	}
	
	
	/* 3D View */
	else if (strstr(opname, "VIEW3D_OT")) {
		km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
	}
	else if (strstr(opname, "OBJECT_OT")) {
		km = WM_keymap_find_all(C, "Object Mode", 0, 0);
	}

	
	/* Editing Modes */
	else if (strstr(opname, "MESH_OT")) {
		km = WM_keymap_find_all(C, "Mesh", 0, 0);
		
		/* some mesh operators are active in object mode too, like add-prim */
		if(km && km->poll && km->poll((bContext *)C)==0) {
			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
		}
	}
	else if (strstr(opname, "CURVE_OT")) {
		km = WM_keymap_find_all(C, "Curve", 0, 0);
		
		/* some curve operators are active in object mode too, like add-prim */
		if(km && km->poll && km->poll((bContext *)C)==0) {
			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
		}
	}
	else if (strstr(opname, "ARMATURE_OT")) {
		km = WM_keymap_find_all(C, "Armature", 0, 0);
	}
	else if (strstr(opname, "POSE_OT")) {
		km = WM_keymap_find_all(C, "Pose", 0, 0);
	}
	else if (strstr(opname, "SCULPT_OT")) {
		km = WM_keymap_find_all(C, "Sculpt", 0, 0);
	}
	else if (strstr(opname, "MBALL_OT")) {
		km = WM_keymap_find_all(C, "Metaball", 0, 0);
		
		/* some mball operators are active in object mode too, like add-prim */
		if(km && km->poll && km->poll((bContext *)C)==0) {
			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
		}
	}
	else if (strstr(opname, "LATTICE_OT")) {
		km = WM_keymap_find_all(C, "Lattice", 0, 0);
	}
	else if (strstr(opname, "PARTICLE_OT")) {
		km = WM_keymap_find_all(C, "Particle", 0, 0);
	}
	else if (strstr(opname, "FONT_OT")) {
		km = WM_keymap_find_all(C, "Font", 0, 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;
		}
	}
	/* Paint Face Mask */
	else if (strstr(opname, "PAINT_OT_face_select")) {
		km = WM_keymap_find_all(C, "Face Mask", sl->spacetype, 0);
	}
	/* Timeline */
	else if (strstr(opname, "TIME_OT")) {
		km = WM_keymap_find_all(C, "Timeline", sl->spacetype, 0);
	}
	/* Image Editor */
	else if (strstr(opname, "IMAGE_OT")) {
		km = WM_keymap_find_all(C, "Image", sl->spacetype, 0);
	}
	/* UV Editor */
	else if (strstr(opname, "UV_OT")) {
		km = WM_keymap_find_all(C, "UV Editor", sl->spacetype, 0);
	}
	/* Node Editor */
	else if (strstr(opname, "NODE_OT")) {
		km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
	}
	/* Animation Editor Channels */
	else if (strstr(opname, "ANIM_OT_channels")) {
		km = WM_keymap_find_all(C, "Animation Channels", sl->spacetype, 0);
	}
	/* Animation Generic - after channels */
	else if (strstr(opname, "ANIM_OT")) {
		km = WM_keymap_find_all(C, "Animation", 0, 0);
	}
	/* Graph Editor */
	else if (strstr(opname, "GRAPH_OT")) {
		km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
	}
	/* Dopesheet Editor */
	else if (strstr(opname, "ACTION_OT")) {
		km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
	}
	/* NLA Editor */
	else if (strstr(opname, "NLA_OT")) {
		km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
	}
	/* Script */
	else if (strstr(opname, "SCRIPT_OT")) {
		km = WM_keymap_find_all(C, "Script", sl->spacetype, 0);
	}
	/* Text */
	else if (strstr(opname, "TEXT_OT")) {
		km = WM_keymap_find_all(C, "Text", sl->spacetype, 0);
	}
	/* Sequencer */
	else if (strstr(opname, "SEQUENCER_OT")) {
		km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
	}
	/* Console */
	else if (strstr(opname, "CONSOLE_OT")) {
		km = WM_keymap_find_all(C, "Console", sl->spacetype, 0);
	}
	/* Console */
	else if (strstr(opname, "INFO_OT")) {
		km = WM_keymap_find_all(C, "Info", sl->spacetype, 0);
	}
	
	/* Transform */
	else if (strstr(opname, "TRANSFORM_OT")) {
		
		/* check for relevant editor */
		switch(sl->spacetype) {
			case SPACE_VIEW3D:
				km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
				break;
			case SPACE_IPO:
				km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
				break;
			case SPACE_ACTION:
				km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
				break;
			case SPACE_NLA:
				km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
				break;
			case SPACE_IMAGE:
				km = WM_keymap_find_all(C, "UV Editor", sl->spacetype, 0);
				break;
			case SPACE_NODE:
				km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
				break;
			case SPACE_SEQ:
				km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
				break;
		}
	}
	
	return km;
}