2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-12-17 10:47:55 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-12-17 10:47:55 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation, Joshua Leung
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/interface/interface_ops.c
|
|
|
|
* \ingroup edinterface
|
|
|
|
*/
|
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
2010-03-30 04:27:13 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2010-11-17 12:02:36 +00:00
|
|
|
#include "DNA_text_types.h" /* for UI_OT_reports_to_text */
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2010-01-07 09:55:11 +00:00
|
|
|
#include "BLI_math_color.h"
|
2012-06-14 22:48:40 +00:00
|
|
|
#include "BLI_math_vector.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-12-17 10:47:55 +00:00
|
|
|
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
#include "BLF_api.h"
|
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
#include "BKE_context.h"
|
2011-11-04 01:15:04 +00:00
|
|
|
#include "BKE_screen.h"
|
2010-11-17 12:02:36 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_text.h" /* for UI_OT_reports_to_text */
|
|
|
|
#include "BKE_report.h"
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
2010-03-30 04:27:13 +00:00
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
|
|
|
#include "interface_intern.h"
|
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
2011-10-23 04:13:56 +00:00
|
|
|
/* only for UI_OT_editsource */
|
|
|
|
#include "ED_screen.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BLI_ghash.h"
|
2009-12-17 10:47:55 +00:00
|
|
|
|
2012-08-16 14:47:14 +00:00
|
|
|
#include "ED_image.h" /* for HDR color sampling */
|
|
|
|
#include "ED_node.h" /* for HDR color sampling */
|
2012-08-20 16:56:11 +00:00
|
|
|
#include "ED_clip.h" /* for HDR color sampling */
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* ********************************************************** */
|
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
typedef struct Eyedropper {
|
2012-06-14 22:48:40 +00:00
|
|
|
short do_color_management;
|
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
PointerRNA ptr;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
int index;
|
2012-06-14 22:48:40 +00:00
|
|
|
|
|
|
|
int accum_start; /* has mouse been presed */
|
2012-06-15 08:33:33 +00:00
|
|
|
float accum_col[3];
|
2012-06-14 22:48:40 +00:00
|
|
|
int accum_tot;
|
2010-01-07 09:55:11 +00:00
|
|
|
} Eyedropper;
|
|
|
|
|
|
|
|
static int eyedropper_init(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-06-14 22:48:40 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
const int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
|
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
Eyedropper *eye;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper");
|
2010-01-07 09:55:11 +00:00
|
|
|
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &eye->ptr, &eye->prop, &eye->index);
|
2012-06-14 22:48:40 +00:00
|
|
|
|
|
|
|
if ((eye->ptr.data == NULL) ||
|
|
|
|
(eye->prop == NULL) ||
|
|
|
|
(RNA_property_editable(&eye->ptr, eye->prop) == FALSE) ||
|
|
|
|
(RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
|
|
|
|
(RNA_property_type(eye->prop) != PROP_FLOAT))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
eye->do_color_management = (color_manage && RNA_property_subtype(eye->prop) == PROP_COLOR);
|
|
|
|
|
|
|
|
return TRUE;
|
2010-01-07 09:55:11 +00:00
|
|
|
}
|
2012-06-14 22:48:40 +00:00
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
static void eyedropper_exit(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
WM_cursor_restore(CTX_wm_window(C));
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (op->customdata)
|
2010-01-07 09:55:11 +00:00
|
|
|
MEM_freeN(op->customdata);
|
2012-03-30 01:51:25 +00:00
|
|
|
op->customdata = NULL;
|
2010-01-07 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int eyedropper_cancel(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
eyedropper_exit(C, op);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-06-14 22:48:40 +00:00
|
|
|
/* *** eyedropper_color_ helper functions *** */
|
2012-06-15 08:33:33 +00:00
|
|
|
|
2012-08-16 14:47:14 +00:00
|
|
|
/**
|
|
|
|
* \brief get the color from the screen.
|
|
|
|
*
|
|
|
|
* Special check for image or nodes where we MAY have HDR pixels which don't display.
|
|
|
|
*/
|
|
|
|
static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int mx, int my, float r_col[3])
|
2010-01-07 09:55:11 +00:00
|
|
|
{
|
2012-08-16 14:47:14 +00:00
|
|
|
|
|
|
|
/* we could use some clever */
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
ScrArea *sa;
|
|
|
|
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
|
2012-08-23 18:25:45 +00:00
|
|
|
if (BLI_rcti_isect_pt(&sa->totrct, mx, my)) {
|
2012-08-16 14:47:14 +00:00
|
|
|
if (sa->spacetype == SPACE_IMAGE) {
|
|
|
|
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
2012-08-23 18:25:45 +00:00
|
|
|
if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
|
2012-08-16 14:47:14 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
int mval[2] = {mx - ar->winrct.xmin,
|
|
|
|
my - ar->winrct.ymin};
|
|
|
|
|
|
|
|
if (ED_space_image_color_sample(sima, ar, mval, r_col)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sa->spacetype == SPACE_NODE) {
|
|
|
|
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
2012-08-23 18:25:45 +00:00
|
|
|
if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
|
2012-08-16 14:47:14 +00:00
|
|
|
SpaceNode *snode = sa->spacedata.first;
|
|
|
|
int mval[2] = {mx - ar->winrct.xmin,
|
|
|
|
my - ar->winrct.ymin};
|
|
|
|
|
|
|
|
if (ED_space_node_color_sample(snode, ar, mval, r_col)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-20 16:56:11 +00:00
|
|
|
else if (sa->spacetype == SPACE_CLIP) {
|
|
|
|
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
2012-08-23 18:25:45 +00:00
|
|
|
if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
|
2012-08-20 16:56:11 +00:00
|
|
|
SpaceClip *sc = sa->spacedata.first;
|
|
|
|
int mval[2] = {mx - ar->winrct.xmin,
|
|
|
|
my - ar->winrct.ymin};
|
|
|
|
|
|
|
|
if (ED_space_clip_color_sample(sc, ar, mval, r_col)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-16 14:47:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fallback to simple opengl picker */
|
2012-06-14 22:48:40 +00:00
|
|
|
glReadBuffer(GL_FRONT);
|
|
|
|
glReadPixels(mx, my, 1, 1, GL_RGB, GL_FLOAT, r_col);
|
|
|
|
glReadBuffer(GL_BACK);
|
|
|
|
}
|
2010-01-07 09:55:11 +00:00
|
|
|
|
2012-06-15 08:33:33 +00:00
|
|
|
/* sets the sample color RGB, maintaining A */
|
|
|
|
static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3])
|
2012-06-14 22:48:40 +00:00
|
|
|
{
|
2012-06-15 08:33:33 +00:00
|
|
|
float col_conv[4];
|
|
|
|
|
|
|
|
/* to maintain alpha */
|
|
|
|
RNA_property_float_get_array(&eye->ptr, eye->prop, col_conv);
|
|
|
|
|
2012-06-14 22:48:40 +00:00
|
|
|
/* convert from screen (srgb) space to linear rgb space */
|
|
|
|
if (eye->do_color_management) {
|
2012-06-15 08:33:33 +00:00
|
|
|
srgb_to_linearrgb_v3_v3(col_conv, col);
|
2012-06-14 22:48:40 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-06-15 08:33:33 +00:00
|
|
|
copy_v3_v3(col_conv, col);
|
2010-01-07 09:55:11 +00:00
|
|
|
}
|
2012-06-14 22:48:40 +00:00
|
|
|
|
2012-06-15 08:33:33 +00:00
|
|
|
RNA_property_float_set_array(&eye->ptr, eye->prop, col_conv);
|
2012-06-14 22:48:40 +00:00
|
|
|
|
|
|
|
RNA_property_update(C, &eye->ptr, eye->prop);
|
|
|
|
}
|
|
|
|
|
2012-06-15 08:33:33 +00:00
|
|
|
/* set sample from accumulated values */
|
2012-06-14 22:48:40 +00:00
|
|
|
static void eyedropper_color_set_accum(bContext *C, Eyedropper *eye)
|
|
|
|
{
|
|
|
|
float col[4];
|
2012-06-15 08:33:33 +00:00
|
|
|
mul_v3_v3fl(col, eye->accum_col, 1.0f / (float)eye->accum_tot);
|
2012-06-14 22:48:40 +00:00
|
|
|
eyedropper_color_set(C, eye, col);
|
|
|
|
}
|
|
|
|
|
2012-06-15 08:33:33 +00:00
|
|
|
/* single point sample & set */
|
2012-06-14 22:48:40 +00:00
|
|
|
static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my)
|
|
|
|
{
|
2012-06-15 08:33:33 +00:00
|
|
|
float col[3];
|
2012-08-16 14:47:14 +00:00
|
|
|
eyedropper_color_sample_fl(C, eye, mx, my, col);
|
2012-06-14 22:48:40 +00:00
|
|
|
eyedropper_color_set(C, eye, col);
|
|
|
|
}
|
|
|
|
|
2012-08-16 14:47:14 +00:00
|
|
|
static void eyedropper_color_sample_accum(bContext *C, Eyedropper *eye, int mx, int my)
|
2012-06-14 22:48:40 +00:00
|
|
|
{
|
2012-06-15 08:33:33 +00:00
|
|
|
float col[3];
|
2012-08-16 14:47:14 +00:00
|
|
|
eyedropper_color_sample_fl(C, eye, mx, my, col);
|
2012-06-14 22:48:40 +00:00
|
|
|
/* delay linear conversion */
|
2012-06-15 08:33:33 +00:00
|
|
|
add_v3_v3(eye->accum_col, col);
|
2012-06-14 22:48:40 +00:00
|
|
|
eye->accum_tot++;
|
2010-01-07 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* main modal status check */
|
|
|
|
static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
Eyedropper *eye = (Eyedropper *)op->customdata;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
switch (event->type) {
|
2010-01-07 09:55:11 +00:00
|
|
|
case ESCKEY:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
return eyedropper_cancel(C, op);
|
|
|
|
case LEFTMOUSE:
|
2012-03-30 01:51:25 +00:00
|
|
|
if (event->val == KM_RELEASE) {
|
2012-06-14 22:48:40 +00:00
|
|
|
if (eye->accum_tot == 0) {
|
|
|
|
eyedropper_color_sample(C, eye, event->x, event->y);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eyedropper_color_set_accum(C, eye);
|
|
|
|
}
|
2010-01-07 09:55:11 +00:00
|
|
|
eyedropper_exit(C, op);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
2012-06-14 22:48:40 +00:00
|
|
|
else if (event->val == KM_PRESS) {
|
|
|
|
/* enable accum and make first sample */
|
|
|
|
eye->accum_start = TRUE;
|
2012-08-16 14:47:14 +00:00
|
|
|
eyedropper_color_sample_accum(C, eye, event->x, event->y);
|
2012-06-14 22:48:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MOUSEMOVE:
|
|
|
|
if (eye->accum_start) {
|
|
|
|
/* button is pressed so keep sampling */
|
2012-08-16 14:47:14 +00:00
|
|
|
eyedropper_color_sample_accum(C, eye, event->x, event->y);
|
2012-06-14 22:48:40 +00:00
|
|
|
eyedropper_color_set_accum(C, eye);
|
|
|
|
}
|
2010-01-07 09:55:11 +00:00
|
|
|
break;
|
2012-06-15 08:33:33 +00:00
|
|
|
case SPACEKEY:
|
|
|
|
if (event->val == KM_RELEASE) {
|
|
|
|
eye->accum_tot = 0;
|
|
|
|
zero_v3(eye->accum_col);
|
2012-08-16 14:47:14 +00:00
|
|
|
eyedropper_color_sample_accum(C, eye, event->x, event->y);
|
2012-06-15 08:33:33 +00:00
|
|
|
eyedropper_color_set_accum(C, eye);
|
|
|
|
}
|
|
|
|
break;
|
2010-01-07 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modal Operator init */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
2010-01-07 09:55:11 +00:00
|
|
|
{
|
|
|
|
/* init */
|
|
|
|
if (eyedropper_init(C, op)) {
|
|
|
|
WM_cursor_modal(CTX_wm_window(C), BC_EYEDROPPER_CURSOR);
|
|
|
|
|
|
|
|
/* add temp handler */
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-01-07 09:55:11 +00:00
|
|
|
eyedropper_exit(C, op);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Repeat operator */
|
2012-03-30 01:51:25 +00:00
|
|
|
static int eyedropper_exec(bContext *C, wmOperator *op)
|
2010-01-07 09:55:11 +00:00
|
|
|
{
|
|
|
|
/* init */
|
|
|
|
if (eyedropper_init(C, op)) {
|
|
|
|
|
|
|
|
/* do something */
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
eyedropper_exit(C, op);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-01-07 09:55:11 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int eyedropper_poll(bContext *C)
|
|
|
|
{
|
|
|
|
if (!CTX_wm_window(C)) return 0;
|
|
|
|
else return 1;
|
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_eyedropper(wmOperatorType *ot)
|
2010-01-07 09:55:11 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Eyedropper";
|
|
|
|
ot->idname = "UI_OT_eyedropper";
|
|
|
|
ot->description = "Sample a color from the Blender Window to store in a property";
|
2010-01-07 09:55:11 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = eyedropper_invoke;
|
|
|
|
ot->modal = eyedropper_modal;
|
|
|
|
ot->cancel = eyedropper_cancel;
|
|
|
|
ot->exec = eyedropper_exec;
|
|
|
|
ot->poll = eyedropper_poll;
|
2010-01-07 09:55:11 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_BLOCKING;
|
2010-01-07 09:55:11 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
}
|
|
|
|
|
2010-03-30 04:27:13 +00:00
|
|
|
/* Reset Default Theme ------------------------ */
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
|
2010-03-30 04:27:13 +00:00
|
|
|
{
|
|
|
|
ui_theme_init_default();
|
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_reset_default_theme(wmOperatorType *ot)
|
2010-03-30 04:27:13 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Reset to Default Theme";
|
|
|
|
ot->idname = "UI_OT_reset_default_theme";
|
|
|
|
ot->description = "Reset to the default theme colors";
|
2010-03-30 04:27:13 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = reset_default_theme_exec;
|
2010-03-30 04:27:13 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2010-03-30 04:27:13 +00:00
|
|
|
}
|
2010-01-07 09:55:11 +00:00
|
|
|
|
2009-12-17 17:15:38 +00:00
|
|
|
/* Copy Data Path Operator ------------------------ */
|
2009-12-17 10:47:55 +00:00
|
|
|
|
2012-05-09 15:54:25 +00:00
|
|
|
static int copy_data_path_button_poll(bContext *C)
|
|
|
|
{
|
|
|
|
PointerRNA ptr;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
char *path;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
|
|
|
|
|
|
|
if (ptr.id.data && ptr.data && prop) {
|
|
|
|
path = RNA_path_from_ID_to_property(&ptr, prop);
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
MEM_freeN(path);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-12-17 10:47:55 +00:00
|
|
|
{
|
|
|
|
PointerRNA ptr;
|
2009-12-17 17:15:38 +00:00
|
|
|
PropertyRNA *prop;
|
2009-12-17 10:47:55 +00:00
|
|
|
char *path;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
/* try to create driver using property retrieved from UI */
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
2009-12-17 10:47:55 +00:00
|
|
|
|
2010-09-23 20:26:03 +00:00
|
|
|
if (ptr.id.data && ptr.data && prop) {
|
2012-03-30 01:51:25 +00:00
|
|
|
path = RNA_path_from_ID_to_property(&ptr, prop);
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
if (path) {
|
|
|
|
WM_clipboard_text_set(path, FALSE);
|
|
|
|
MEM_freeN(path);
|
2012-05-09 15:54:25 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-09 15:54:25 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_copy_data_path_button(wmOperatorType *ot)
|
2009-12-17 10:47:55 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Copy Data Path";
|
|
|
|
ot->idname = "UI_OT_copy_data_path_button";
|
|
|
|
ot->description = "Copy the RNA data path for this property to the clipboard";
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = copy_data_path_button_exec;
|
2012-05-09 15:54:25 +00:00
|
|
|
ot->poll = copy_data_path_button_poll;
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reset to Default Values Button Operator ------------------------ */
|
|
|
|
|
2009-12-17 17:15:38 +00:00
|
|
|
static int reset_default_button_poll(bContext *C)
|
|
|
|
{
|
|
|
|
PointerRNA ptr;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
int index;
|
|
|
|
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
return (ptr.data && prop && RNA_property_editable(&ptr, prop));
|
|
|
|
}
|
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
static int reset_default_button_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
PointerRNA ptr;
|
2009-12-17 17:15:38 +00:00
|
|
|
PropertyRNA *prop;
|
2012-03-30 01:51:25 +00:00
|
|
|
int success = 0;
|
2009-12-17 17:15:38 +00:00
|
|
|
int index, all = RNA_boolean_get(op->ptr, "all");
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* try to reset the nominated setting to its default value */
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* if there is a valid property that is editable... */
|
|
|
|
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
|
2012-03-30 01:51:25 +00:00
|
|
|
if (RNA_property_reset(&ptr, prop, (all) ? -1 : index)) {
|
2009-12-17 17:15:38 +00:00
|
|
|
/* perform updates required for this property */
|
|
|
|
RNA_property_update(C, &ptr, prop);
|
2011-09-28 18:45:17 +00:00
|
|
|
|
|
|
|
/* as if we pressed the button */
|
|
|
|
uiContextActivePropertyHandle(C);
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
success = 1;
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
}
|
2011-09-28 18:45:17 +00:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* Since we don't want to undo _all_ edits to settings, eg window
|
2011-09-28 18:45:17 +00:00
|
|
|
* edits on the screen or on operator settings.
|
|
|
|
* it might be better to move undo's inline - campbell */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (success) {
|
2012-03-30 01:51:25 +00:00
|
|
|
ID *id = ptr.id.data;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (id && ID_CHECK_UNDO(id)) {
|
2011-09-28 18:45:17 +00:00
|
|
|
/* do nothing, go ahead with undo */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* end hack */
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_reset_default_button(wmOperatorType *ot)
|
2009-12-17 10:47:55 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Reset to Default Value";
|
|
|
|
ot->idname = "UI_OT_reset_default_button";
|
|
|
|
ot->description = "Reset this property's value to its default value";
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = reset_default_button_poll;
|
|
|
|
ot->exec = reset_default_button_exec;
|
2009-12-17 10:47:55 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_UNDO;
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
/* properties */
|
2011-09-19 12:26:20 +00:00
|
|
|
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy To Selected Operator ------------------------ */
|
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, int *use_path)
|
2009-12-17 17:15:38 +00:00
|
|
|
{
|
2012-05-19 13:28:19 +00:00
|
|
|
*use_path = FALSE;
|
2012-04-19 10:49:45 +00:00
|
|
|
|
2012-04-10 15:49:41 +00:00
|
|
|
if (RNA_struct_is_a(ptr->type, &RNA_EditBone))
|
2009-12-17 17:15:38 +00:00
|
|
|
*lb = CTX_data_collection_get(C, "selected_editable_bones");
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone))
|
2009-12-17 17:15:38 +00:00
|
|
|
*lb = CTX_data_collection_get(C, "selected_pose_bones");
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_Sequence))
|
2010-07-04 09:13:00 +00:00
|
|
|
*lb = CTX_data_collection_get(C, "selected_editable_sequences");
|
2012-04-10 15:49:41 +00:00
|
|
|
else {
|
|
|
|
ID *id = ptr->id.data;
|
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (id && GS(id->name) == ID_OB) {
|
2012-04-10 15:49:41 +00:00
|
|
|
*lb = CTX_data_collection_get(C, "selected_editable_objects");
|
2012-05-19 13:28:19 +00:00
|
|
|
*use_path = TRUE;
|
2012-04-19 10:49:45 +00:00
|
|
|
}
|
2012-04-10 15:49:41 +00:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-17 10:47:55 +00:00
|
|
|
|
2009-12-17 17:15:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int copy_to_selected_button_poll(bContext *C)
|
|
|
|
{
|
2012-04-10 15:49:41 +00:00
|
|
|
PointerRNA ptr, lptr, idptr;
|
|
|
|
PropertyRNA *prop, *lprop;
|
2012-03-30 01:51:25 +00:00
|
|
|
int index, success = 0;
|
2009-12-17 17:15:38 +00:00
|
|
|
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
if (ptr.data && prop) {
|
2012-04-19 10:49:45 +00:00
|
|
|
char *path = NULL;
|
|
|
|
int use_path;
|
2009-12-17 17:15:38 +00:00
|
|
|
CollectionPointerLink *link;
|
|
|
|
ListBase lb;
|
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (!copy_to_selected_list(C, &ptr, &lb, &use_path))
|
|
|
|
return success;
|
|
|
|
|
|
|
|
if (!use_path || (path = RNA_path_from_ID_to_property(&ptr, prop))) {
|
2012-04-10 15:49:41 +00:00
|
|
|
for (link = lb.first; link; link = link->next) {
|
|
|
|
if (link->ptr.data != ptr.data) {
|
2012-04-19 10:49:45 +00:00
|
|
|
if (use_path) {
|
|
|
|
lprop = NULL;
|
|
|
|
RNA_id_pointer_create(link->ptr.id.data, &idptr);
|
|
|
|
RNA_path_resolve(&idptr, path, &lptr, &lprop);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lptr = link->ptr;
|
|
|
|
lprop = prop;
|
|
|
|
}
|
2012-04-10 15:49:41 +00:00
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (lprop == prop) {
|
2012-04-10 15:49:41 +00:00
|
|
|
if (RNA_property_editable(&lptr, prop))
|
|
|
|
success = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-12-17 17:15:38 +00:00
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (path)
|
|
|
|
MEM_freeN(path);
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
2012-04-10 15:49:41 +00:00
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
BLI_freelistN(&lb);
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-04-10 15:49:41 +00:00
|
|
|
PointerRNA ptr, lptr, idptr;
|
|
|
|
PropertyRNA *prop, *lprop;
|
2012-03-30 01:51:25 +00:00
|
|
|
int success = 0;
|
2009-12-17 17:15:38 +00:00
|
|
|
int index, all = RNA_boolean_get(op->ptr, "all");
|
|
|
|
|
|
|
|
/* try to reset the nominated setting to its default value */
|
2010-09-25 14:32:26 +00:00
|
|
|
uiContextActiveProperty(C, &ptr, &prop, &index);
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
/* if there is a valid property that is editable... */
|
|
|
|
if (ptr.data && prop) {
|
2012-04-19 10:49:45 +00:00
|
|
|
char *path = NULL;
|
|
|
|
int use_path;
|
2009-12-17 17:15:38 +00:00
|
|
|
CollectionPointerLink *link;
|
|
|
|
ListBase lb;
|
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (!copy_to_selected_list(C, &ptr, &lb, &use_path))
|
|
|
|
return success;
|
|
|
|
|
|
|
|
if (!use_path || (path = RNA_path_from_ID_to_property(&ptr, prop))) {
|
2012-03-30 01:51:25 +00:00
|
|
|
for (link = lb.first; link; link = link->next) {
|
2012-04-10 15:49:41 +00:00
|
|
|
if (link->ptr.data != ptr.data) {
|
2012-04-19 10:49:45 +00:00
|
|
|
if (use_path) {
|
|
|
|
lprop = NULL;
|
|
|
|
RNA_id_pointer_create(link->ptr.id.data, &idptr);
|
|
|
|
RNA_path_resolve(&idptr, path, &lptr, &lprop);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lptr = link->ptr;
|
|
|
|
lprop = prop;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lprop == prop) {
|
|
|
|
if (RNA_property_editable(&lptr, lprop)) {
|
2012-04-10 15:49:41 +00:00
|
|
|
if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) {
|
|
|
|
RNA_property_update(C, &lptr, prop);
|
|
|
|
success = 1;
|
|
|
|
}
|
|
|
|
}
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
if (path)
|
|
|
|
MEM_freeN(path);
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
2012-04-10 15:49:41 +00:00
|
|
|
|
2012-04-19 10:49:45 +00:00
|
|
|
BLI_freelistN(&lb);
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
2009-12-17 17:15:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
|
2009-12-17 17:15:38 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Copy To Selected";
|
|
|
|
ot->idname = "UI_OT_copy_to_selected_button";
|
|
|
|
ot->description = "Copy property from this object to selected objects or bones";
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = copy_to_selected_button_poll;
|
|
|
|
ot->exec = copy_to_selected_button_exec;
|
2009-12-17 17:15:38 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-30 01:51:25 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-12-17 17:15:38 +00:00
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
/* properties */
|
2011-09-19 12:26:20 +00:00
|
|
|
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
2010-11-17 12:02:36 +00:00
|
|
|
|
|
|
|
/* Reports to Textblock Operator ------------------------ */
|
|
|
|
|
|
|
|
/* FIXME: this is just a temporary operator so that we can see all the reports somewhere
|
|
|
|
* when there are too many to display...
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int reports_to_text_poll(bContext *C)
|
|
|
|
{
|
|
|
|
return CTX_wm_reports(C) != NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-17 14:36:19 +00:00
|
|
|
static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
|
2010-11-17 12:02:36 +00:00
|
|
|
{
|
|
|
|
ReportList *reports = CTX_wm_reports(C);
|
|
|
|
Text *txt;
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
/* create new text-block to write to */
|
2012-05-05 14:52:04 +00:00
|
|
|
txt = BKE_text_add("Recent Reports");
|
2010-11-17 12:02:36 +00:00
|
|
|
|
|
|
|
/* convert entire list to a display string, and add this to the text-block
|
|
|
|
* - if commandline debug option enabled, show debug reports too
|
|
|
|
* - otherwise, up to info (which is what users normally see)
|
|
|
|
*/
|
2012-03-31 00:59:17 +00:00
|
|
|
str = BKE_reports_string(reports, (G.debug & G_DEBUG) ? RPT_DEBUG : RPT_INFO);
|
2011-12-12 03:25:10 +00:00
|
|
|
|
|
|
|
if (str) {
|
2012-05-05 14:52:04 +00:00
|
|
|
BKE_text_write(txt, str);
|
2011-12-12 03:25:10 +00:00
|
|
|
MEM_freeN(str);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
2010-11-17 12:02:36 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void UI_OT_reports_to_textblock(wmOperatorType *ot)
|
2010-11-17 12:02:36 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Reports to Text Block";
|
|
|
|
ot->idname = "UI_OT_reports_to_textblock";
|
|
|
|
ot->description = "Write the reports ";
|
2010-11-17 12:02:36 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = reports_to_text_poll;
|
|
|
|
ot->exec = reports_to_text_exec;
|
2010-11-17 12:02:36 +00:00
|
|
|
}
|
|
|
|
|
2011-11-03 23:20:54 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* EditSource Utility funcs and operator,
|
2012-03-04 04:35:12 +00:00
|
|
|
* note, this includes utility functions and button matching checks */
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
struct uiEditSourceStore {
|
|
|
|
uiBut but_orig;
|
|
|
|
GHash *hash;
|
|
|
|
} uiEditSourceStore;
|
|
|
|
|
|
|
|
struct uiEditSourceButStore {
|
2012-01-16 05:52:33 +00:00
|
|
|
char py_dbg_fn[FILE_MAX];
|
2011-10-23 04:13:56 +00:00
|
|
|
int py_dbg_ln;
|
|
|
|
} uiEditSourceButStore;
|
|
|
|
|
|
|
|
/* should only ever be set while the edit source operator is running */
|
2012-03-30 01:51:25 +00:00
|
|
|
static struct uiEditSourceStore *ui_editsource_info = NULL;
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
int UI_editsource_enable_check(void)
|
|
|
|
{
|
|
|
|
return (ui_editsource_info != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ui_editsource_active_but_set(uiBut *but)
|
|
|
|
{
|
|
|
|
BLI_assert(ui_editsource_info == NULL);
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
ui_editsource_info = MEM_callocN(sizeof(uiEditSourceStore), __func__);
|
2011-10-23 04:13:56 +00:00
|
|
|
memcpy(&ui_editsource_info->but_orig, but, sizeof(uiBut));
|
|
|
|
|
2012-05-16 00:51:36 +00:00
|
|
|
ui_editsource_info->hash = BLI_ghash_ptr_new(__func__);
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ui_editsource_active_but_clear(void)
|
|
|
|
{
|
|
|
|
BLI_ghash_free(ui_editsource_info->hash, NULL, (GHashValFreeFP)MEM_freeN);
|
|
|
|
MEM_freeN(ui_editsource_info);
|
2012-03-30 01:51:25 +00:00
|
|
|
ui_editsource_info = NULL;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
printf("matching buttons: '%s' == '%s'\n",
|
|
|
|
but_a->drawstr, but_b->drawstr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* this just needs to be a 'good-enough' comparison so we can know beyond
|
|
|
|
* reasonable doubt that these buttons are the same between redraws.
|
|
|
|
* if this fails it only means edit-source fails - campbell */
|
2012-08-18 18:11:51 +00:00
|
|
|
if (BLI_rctf_compare(&but_a->rect, &but_b->rect, FLT_EPSILON) &&
|
2012-03-30 01:51:25 +00:00
|
|
|
(but_a->type == but_b->type) &&
|
|
|
|
(but_a->rnaprop == but_b->rnaprop) &&
|
|
|
|
(but_a->optype == but_b->optype) &&
|
|
|
|
(but_a->unit_type == but_b->unit_type) &&
|
|
|
|
(strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0))
|
|
|
|
{
|
2011-10-23 04:13:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UI_editsource_active_but_test(uiBut *but)
|
|
|
|
{
|
|
|
|
extern void PyC_FileAndNum_Safe(const char **filename, int *lineno);
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__);
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
const char *fn;
|
2012-03-30 01:51:25 +00:00
|
|
|
int lineno = -1;
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
printf("comparing buttons: '%s' == '%s'\n",
|
|
|
|
but->drawstr, ui_editsource_info->but_orig.drawstr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PyC_FileAndNum_Safe(&fn, &lineno);
|
|
|
|
|
|
|
|
if (lineno != -1) {
|
|
|
|
BLI_strncpy(but_store->py_dbg_fn, fn,
|
2012-03-30 01:51:25 +00:00
|
|
|
sizeof(but_store->py_dbg_fn));
|
|
|
|
but_store->py_dbg_ln = lineno;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-30 01:51:25 +00:00
|
|
|
but_store->py_dbg_fn[0] = '\0';
|
|
|
|
but_store->py_dbg_ln = -1;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BLI_ghash_insert(ui_editsource_info->hash, but, but_store);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int editsource_text_edit(bContext *C, wmOperator *op,
|
2012-01-16 05:52:33 +00:00
|
|
|
char filepath[FILE_MAX], int line)
|
2011-10-23 04:13:56 +00:00
|
|
|
{
|
2012-03-30 01:51:25 +00:00
|
|
|
struct Main *bmain = CTX_data_main(C);
|
2011-10-23 04:13:56 +00:00
|
|
|
Text *text;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
for (text = bmain->text.first; text; text = text->id.next) {
|
2011-10-23 04:13:56 +00:00
|
|
|
if (text->name && BLI_path_cmp(text->name, filepath) == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (text == NULL) {
|
2012-05-05 14:52:04 +00:00
|
|
|
text = BKE_text_load(filepath, bmain->name);
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (text == NULL) {
|
|
|
|
BKE_reportf(op->reports, RPT_WARNING,
|
|
|
|
"file: '%s' can't be opened", filepath);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* naughty!, find text area to set, not good behavior
|
|
|
|
* but since this is a dev tool lets allow it - campbell */
|
2012-03-30 01:51:25 +00:00
|
|
|
ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sa) {
|
2012-03-30 01:51:25 +00:00
|
|
|
SpaceText *st = sa->spacedata.first;
|
|
|
|
st->text = text;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_reportf(op->reports, RPT_INFO,
|
|
|
|
"See '%s' in the text editor", text->id.name + 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
txt_move_toline(text, line - 1, FALSE);
|
2012-03-30 01:51:25 +00:00
|
|
|
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int editsource_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-30 01:51:25 +00:00
|
|
|
uiBut *but = uiContextActiveButton(C);
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
if (but) {
|
|
|
|
GHashIterator ghi;
|
2012-03-30 01:51:25 +00:00
|
|
|
struct uiEditSourceButStore *but_store = NULL;
|
2011-10-23 04:13:56 +00:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2011-10-23 04:13:56 +00:00
|
|
|
int ret;
|
|
|
|
|
2011-10-23 05:08:02 +00:00
|
|
|
/* needed else the active button does not get tested */
|
2011-10-23 04:13:56 +00:00
|
|
|
uiFreeActiveButtons(C, CTX_wm_screen(C));
|
|
|
|
|
|
|
|
// printf("%s: begin\n", __func__);
|
|
|
|
|
2011-10-23 05:08:02 +00:00
|
|
|
/* take care not to return before calling ui_editsource_active_but_clear */
|
2011-10-23 04:13:56 +00:00
|
|
|
ui_editsource_active_but_set(but);
|
|
|
|
|
|
|
|
/* redraw and get active button python info */
|
|
|
|
ED_region_do_draw(C, ar);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
|
2012-03-30 01:51:25 +00:00
|
|
|
!BLI_ghashIterator_isDone(&ghi);
|
|
|
|
BLI_ghashIterator_step(&ghi))
|
2011-10-23 04:13:56 +00:00
|
|
|
{
|
2012-03-30 01:51:25 +00:00
|
|
|
uiBut *but = BLI_ghashIterator_getKey(&ghi);
|
2011-10-23 04:13:56 +00:00
|
|
|
if (but && ui_editsource_uibut_match(&ui_editsource_info->but_orig, but)) {
|
2012-03-30 01:51:25 +00:00
|
|
|
but_store = BLI_ghashIterator_getValue(&ghi);
|
2011-10-23 04:13:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (but_store) {
|
|
|
|
if (but_store->py_dbg_ln != -1) {
|
2012-03-30 01:51:25 +00:00
|
|
|
ret = editsource_text_edit(C, op,
|
|
|
|
but_store->py_dbg_fn,
|
|
|
|
but_store->py_dbg_ln);
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_report(op->reports, RPT_ERROR,
|
2012-03-30 01:51:25 +00:00
|
|
|
"Active button isn't from a script, cant edit source.");
|
|
|
|
ret = OPERATOR_CANCELLED;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_report(op->reports, RPT_ERROR,
|
2012-03-30 01:51:25 +00:00
|
|
|
"Active button match can't be found.");
|
|
|
|
ret = OPERATOR_CANCELLED;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ui_editsource_active_but_clear();
|
|
|
|
|
|
|
|
// printf("%s: end\n", __func__);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void UI_OT_editsource(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
ot->name = "Edit Source";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->idname = "UI_OT_editsource";
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
ot->description = "Edit UI source code of the active button";
|
2011-10-23 04:13:56 +00:00
|
|
|
|
|
|
|
/* callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = editsource_exec;
|
2011-10-23 04:13:56 +00:00
|
|
|
}
|
|
|
|
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* EditTranslation utility funcs and operator,
|
|
|
|
* Note: this includes utility functions and button matching checks.
|
|
|
|
* this only works in conjunction with a py operator! */
|
|
|
|
|
|
|
|
void edittranslation_find_po_file(const char *root, const char *uilng, char *path, const size_t maxlen)
|
|
|
|
{
|
|
|
|
char t[32]; /* Should be more than enough! */
|
|
|
|
/* First, full lang code. */
|
|
|
|
sprintf(t, "%s.po", uilng);
|
|
|
|
BLI_join_dirfile(path, maxlen, root, uilng);
|
|
|
|
BLI_join_dirfile(path, maxlen, path, t);
|
|
|
|
if (BLI_is_file(path))
|
|
|
|
return;
|
|
|
|
/* Now try without the second iso code part (_ES in es_ES). */
|
|
|
|
strncpy(t, uilng, 2);
|
|
|
|
strcpy(t + 2, uilng + 5); /* Because of some codes like sr_SR@latin... */
|
|
|
|
BLI_join_dirfile(path, maxlen, root, t);
|
|
|
|
sprintf(t, "%s.po", t);
|
|
|
|
BLI_join_dirfile(path, maxlen, path, t);
|
|
|
|
if (BLI_is_file(path))
|
|
|
|
return;
|
|
|
|
path[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
static int edittranslation_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
uiBut *but = uiContextActiveButton(C);
|
|
|
|
int ret = OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
if (but) {
|
|
|
|
PointerRNA ptr;
|
|
|
|
char popath[FILE_MAX];
|
|
|
|
const char *root = U.i18ndir;
|
|
|
|
const char *uilng = BLF_lang_get();
|
|
|
|
|
|
|
|
const int bufs_nbr = 10;
|
|
|
|
uiStringInfo but_label = {BUT_GET_LABEL, NULL};
|
|
|
|
uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL};
|
|
|
|
uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
|
|
|
|
uiStringInfo but_tip = {BUT_GET_TIP, NULL};
|
|
|
|
uiStringInfo rna_tip = {BUT_GET_RNA_TIP, NULL};
|
|
|
|
uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL};
|
|
|
|
uiStringInfo rna_struct = {BUT_GET_RNASTRUCT_IDENTIFIER, NULL};
|
|
|
|
uiStringInfo rna_prop = {BUT_GET_RNAPROP_IDENTIFIER, NULL};
|
|
|
|
uiStringInfo rna_enum = {BUT_GET_RNAENUM_IDENTIFIER, NULL};
|
|
|
|
uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL};
|
|
|
|
|
|
|
|
if (!BLI_is_dir(root)) {
|
|
|
|
BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' \"Translation Branches "
|
|
|
|
"Directory\" path to a valid directory.");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
if (!WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0)) {
|
|
|
|
BKE_reportf(op->reports, RPT_ERROR, "Could not find operator \"%s\"! Please enable ui_translate addon "
|
|
|
|
"in the User Preferences.", EDTSRC_I18N_OP_NAME);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
/* Try to find a valid po file for current language... */
|
|
|
|
edittranslation_find_po_file(root, uilng, popath, FILE_MAX);
|
|
|
|
printf("po path: %s\n", popath);
|
|
|
|
if (popath[0] == '\0') {
|
|
|
|
BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s.", uilng, root);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiButGetStrInfo(C, but, bufs_nbr, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
|
|
|
|
&rna_struct, &rna_prop, &rna_enum, &rna_ctxt);
|
|
|
|
|
|
|
|
WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME);
|
|
|
|
RNA_string_set(&ptr, "lang", uilng);
|
|
|
|
RNA_string_set(&ptr, "po_file", popath);
|
|
|
|
RNA_string_set(&ptr, "but_label", but_label.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_label", rna_label.strinfo);
|
|
|
|
RNA_string_set(&ptr, "enum_label", enum_label.strinfo);
|
|
|
|
RNA_string_set(&ptr, "but_tip", but_tip.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_tip", rna_tip.strinfo);
|
|
|
|
RNA_string_set(&ptr, "enum_tip", enum_tip.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_struct", rna_struct.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_prop", rna_prop.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_enum", rna_enum.strinfo);
|
|
|
|
RNA_string_set(&ptr, "rna_ctxt", rna_ctxt.strinfo);
|
|
|
|
ret = WM_operator_name_call(C, EDTSRC_I18N_OP_NAME, WM_OP_INVOKE_DEFAULT, &ptr);
|
|
|
|
|
|
|
|
/* Clean up */
|
|
|
|
if (but_label.strinfo)
|
|
|
|
MEM_freeN(but_label.strinfo);
|
|
|
|
if (rna_label.strinfo)
|
|
|
|
MEM_freeN(rna_label.strinfo);
|
|
|
|
if (enum_label.strinfo)
|
|
|
|
MEM_freeN(enum_label.strinfo);
|
|
|
|
if (but_tip.strinfo)
|
|
|
|
MEM_freeN(but_tip.strinfo);
|
|
|
|
if (rna_tip.strinfo)
|
|
|
|
MEM_freeN(rna_tip.strinfo);
|
|
|
|
if (enum_tip.strinfo)
|
|
|
|
MEM_freeN(enum_tip.strinfo);
|
|
|
|
if (rna_struct.strinfo)
|
|
|
|
MEM_freeN(rna_struct.strinfo);
|
|
|
|
if (rna_prop.strinfo)
|
|
|
|
MEM_freeN(rna_prop.strinfo);
|
|
|
|
if (rna_enum.strinfo)
|
|
|
|
MEM_freeN(rna_enum.strinfo);
|
|
|
|
if (rna_ctxt.strinfo)
|
|
|
|
MEM_freeN(rna_ctxt.strinfo);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_report(op->reports, RPT_ERROR, "Active button not found");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static int edittranslation_poll(bContext *UNUSED(C))
|
|
|
|
{
|
|
|
|
/* We need the i18n py addon to be enabled! */
|
|
|
|
return WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void UI_OT_edittranslation_init(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name = "Edit Translation";
|
|
|
|
ot->idname = "UI_OT_edittranslation_init";
|
|
|
|
ot->description = "Edit i18n in current language for the active button";
|
|
|
|
|
|
|
|
/* callbacks */
|
|
|
|
ot->exec = edittranslation_exec;
|
|
|
|
/* ot->poll = edittranslation_poll;*/
|
|
|
|
}
|
|
|
|
|
2011-11-03 23:20:54 +00:00
|
|
|
#endif /* WITH_PYTHON */
|
2011-10-23 04:13:56 +00:00
|
|
|
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
static int reloadtranslation_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
|
|
|
|
{
|
|
|
|
BLF_lang_init();
|
|
|
|
BLF_cache_clear();
|
|
|
|
BLF_lang_set(NULL);
|
|
|
|
UI_reinit_font();
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void UI_OT_reloadtranslation(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name = "Reload Translation";
|
|
|
|
ot->idname = "UI_OT_reloadtranslation";
|
|
|
|
ot->description = "Force a full reload of UI translation";
|
|
|
|
|
|
|
|
/* callbacks */
|
|
|
|
ot->exec = reloadtranslation_exec;
|
|
|
|
}
|
|
|
|
|
2009-12-17 10:47:55 +00:00
|
|
|
/* ********************************************************* */
|
|
|
|
/* Registration */
|
|
|
|
|
2009-12-17 17:15:38 +00:00
|
|
|
void UI_buttons_operatortypes(void)
|
2009-12-17 10:47:55 +00:00
|
|
|
{
|
2010-01-07 09:55:11 +00:00
|
|
|
WM_operatortype_append(UI_OT_eyedropper);
|
2010-03-30 04:27:13 +00:00
|
|
|
WM_operatortype_append(UI_OT_reset_default_theme);
|
2009-12-17 17:15:38 +00:00
|
|
|
WM_operatortype_append(UI_OT_copy_data_path_button);
|
2009-12-17 10:47:55 +00:00
|
|
|
WM_operatortype_append(UI_OT_reset_default_button);
|
2009-12-17 17:15:38 +00:00
|
|
|
WM_operatortype_append(UI_OT_copy_to_selected_button);
|
2012-08-19 10:41:27 +00:00
|
|
|
WM_operatortype_append(UI_OT_reports_to_textblock); /* XXX: temp? */
|
2011-11-03 23:20:54 +00:00
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
2011-10-23 04:13:56 +00:00
|
|
|
WM_operatortype_append(UI_OT_editsource);
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
WM_operatortype_append(UI_OT_edittranslation_init);
|
2011-11-03 23:20:54 +00:00
|
|
|
#endif
|
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator.
It also adds a few getters (to get RNA i18n context, and current language iso code).
Finally, it adds to C operators needed for the py ui_translation addon:
*UI_OT_edittranslation_init, which gathers requested data and launch the py operator.
*UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files).
For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
2012-07-09 14:25:35 +00:00
|
|
|
WM_operatortype_append(UI_OT_reloadtranslation);
|
2009-12-17 10:47:55 +00:00
|
|
|
}
|
|
|
|
|