I18n: make several parts of the UI translatable

- batch rename
- keyframe settings
- tool name in Tool properties header
- tool name in Tool properties Drag (fake) enum

- new file templates
- new preset
- new text datablock
- new collection datablock
- new geometry nodes (modifier and node group)
- new grease pencil data (layers and materials)

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15533
This commit is contained in:
Damien Picard
2022-08-04 16:13:18 +02:00
committed by Bastien Montagne
parent 0844781961
commit aa53eca6b5
14 changed files with 74 additions and 55 deletions

View File

@@ -3,9 +3,11 @@
import bpy import bpy
from bpy.types import Operator from bpy.types import Operator
from bpy.app.translations import pgettext_data as data_
def geometry_node_group_empty_new(): def geometry_node_group_empty_new():
group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree') group = bpy.data.node_groups.new(data_("Geometry Nodes"), 'GeometryNodeTree')
group.inputs.new('NodeSocketGeometry', "Geometry") group.inputs.new('NodeSocketGeometry', "Geometry")
group.outputs.new('NodeSocketGeometry', "Geometry") group.outputs.new('NodeSocketGeometry', "Geometry")
input_node = group.nodes.new('NodeGroupInput') input_node = group.nodes.new('NodeGroupInput')
@@ -45,7 +47,7 @@ class NewGeometryNodesModifier(Operator):
return geometry_modifier_poll(context) return geometry_modifier_poll(context)
def execute(self, context): def execute(self, context):
modifier = context.object.modifiers.new("GeometryNodes", "NODES") modifier = context.object.modifiers.new(data_("GeometryNodes"), "NODES")
if not modifier: if not modifier:
return {'CANCELLED'} return {'CANCELLED'}

View File

@@ -11,11 +11,13 @@ from bpy.props import (
StringProperty, StringProperty,
) )
from bpy.app.translations import pgettext_data as data_
# For preset popover menu # For preset popover menu
WindowManager.preset_name = StringProperty( WindowManager.preset_name = StringProperty(
name="Preset Name", name="Preset Name",
description="Name for new preset", description="Name for new preset",
default="New Preset" default=data_("New Preset")
) )

View File

@@ -2483,8 +2483,8 @@ class BatchRenameAction(bpy.types.PropertyGroup):
) )
# Weak, add/remove as properties. # Weak, add/remove as properties.
op_add: BoolProperty() op_add: BoolProperty(name="Add")
op_remove: BoolProperty() op_remove: BoolProperty(name="Remove")
class WM_OT_batch_rename(Operator): class WM_OT_batch_rename(Operator):
@@ -2570,7 +2570,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
scene.sequence_editor.sequences_all, scene.sequence_editor.sequences_all,
"name", "name",
"Strip(s)", iface_("Strip(s)"),
) )
elif space_type == 'NODE_EDITOR': elif space_type == 'NODE_EDITOR':
data_type_test = 'NODE' data_type_test = 'NODE'
@@ -2582,7 +2582,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
list(space.node_tree.nodes), list(space.node_tree.nodes),
"name", "name",
"Node(s)", iface_("Node(s)"),
) )
elif space_type == 'OUTLINER': elif space_type == 'OUTLINER':
data_type_test = 'COLLECTION' data_type_test = 'COLLECTION'
@@ -2594,7 +2594,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
scene.collection.children_recursive, scene.collection.children_recursive,
"name", "name",
"Collection(s)", iface_("Collection(s)"),
) )
else: else:
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object): if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
@@ -2607,7 +2607,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
[pbone.bone for ob in context.objects_in_mode_unique_data for pbone in ob.pose.bones], [pbone.bone for ob in context.objects_in_mode_unique_data for pbone in ob.pose.bones],
"name", "name",
"Bone(s)", iface_("Bone(s)"),
) )
elif mode == 'EDIT_ARMATURE': elif mode == 'EDIT_ARMATURE':
data_type_test = 'BONE' data_type_test = 'BONE'
@@ -2619,24 +2619,24 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
[ebone for ob in context.objects_in_mode_unique_data for ebone in ob.data.edit_bones], [ebone for ob in context.objects_in_mode_unique_data for ebone in ob.data.edit_bones],
"name", "name",
"Edit Bone(s)", iface_("Edit Bone(s)"),
) )
if check_context: if check_context:
return 'OBJECT' return 'OBJECT'
object_data_type_attrs_map = { object_data_type_attrs_map = {
'MESH': ("meshes", "Mesh(es)", bpy.types.Mesh), 'MESH': ("meshes", iface_("Mesh(es)"), bpy.types.Mesh),
'CURVE': ("curves", "Curve(s)", bpy.types.Curve), 'CURVE': ("curves", iface_("Curve(s)"), bpy.types.Curve),
'META': ("metaballs", "Metaball(s)", bpy.types.MetaBall), 'META': ("metaballs", iface_("Metaball(s)"), bpy.types.MetaBall),
'VOLUME': ("volumes", "Volume(s)", bpy.types.Volume), 'VOLUME': ("volumes", iface_("Volume(s)"), bpy.types.Volume),
'GPENCIL': ("grease_pencils", "Grease Pencil(s)", bpy.types.GreasePencil), 'GPENCIL': ("grease_pencils", iface_("Grease Pencil(s)"), bpy.types.GreasePencil),
'ARMATURE': ("armatures", "Armature(s)", bpy.types.Armature), 'ARMATURE': ("armatures", iface_("Armature(s)"), bpy.types.Armature),
'LATTICE': ("lattices", "Lattice(s)", bpy.types.Lattice), 'LATTICE': ("lattices", iface_("Lattice(s)"), bpy.types.Lattice),
'LIGHT': ("lights", "Light(s)", bpy.types.Light), 'LIGHT': ("lights", iface_("Light(s)"), bpy.types.Light),
'LIGHT_PROBE': ("light_probes", "Light Probe(s)", bpy.types.LightProbe), 'LIGHT_PROBE': ("light_probes", iface_("Light Probe(s)"), bpy.types.LightProbe),
'CAMERA': ("cameras", "Camera(s)", bpy.types.Camera), 'CAMERA': ("cameras", iface_("Camera(s)"), bpy.types.Camera),
'SPEAKER': ("speakers", "Speaker(s)", bpy.types.Speaker), 'SPEAKER': ("speakers", iface_("Speaker(s)"), bpy.types.Speaker),
} }
# Finish with space types. # Finish with space types.
@@ -2654,7 +2654,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
[id for id in bpy.data.objects if id.library is None], [id for id in bpy.data.objects if id.library is None],
"name", "name",
"Object(s)", iface_("Object(s)"),
) )
elif data_type == 'COLLECTION': elif data_type == 'COLLECTION':
data = ( data = (
@@ -2669,7 +2669,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
[id for id in bpy.data.collections if id.library is None], [id for id in bpy.data.collections if id.library is None],
"name", "name",
"Collection(s)", iface_("Collection(s)"),
) )
elif data_type == 'MATERIAL': elif data_type == 'MATERIAL':
data = ( data = (
@@ -2688,7 +2688,7 @@ class WM_OT_batch_rename(Operator):
if only_selected else if only_selected else
[id for id in bpy.data.materials if id.library is None], [id for id in bpy.data.materials if id.library is None],
"name", "name",
"Material(s)", iface_("Material(s)"),
) )
elif data_type in object_data_type_attrs_map.keys(): elif data_type in object_data_type_attrs_map.keys():
attr, descr, ty = object_data_type_attrs_map[data_type] attr, descr, ty = object_data_type_attrs_map[data_type]
@@ -2913,7 +2913,7 @@ class WM_OT_batch_rename(Operator):
row.prop(action, "op_remove", text="", icon='REMOVE') row.prop(action, "op_remove", text="", icon='REMOVE')
row.prop(action, "op_add", text="", icon='ADD') row.prop(action, "op_add", text="", icon='ADD')
layout.label(text="Rename %d %s" % (len(self._data[0]), self._data[2])) layout.label(text=iface_("Rename %d %s") % (len(self._data[0]), self._data[2]))
def check(self, context): def check(self, context):
changed = False changed = False
@@ -2974,7 +2974,7 @@ class WM_OT_batch_rename(Operator):
change_len += 1 change_len += 1
total_len += 1 total_len += 1
self.report({'INFO'}, "Renamed %d of %d %s" % (change_len, total_len, descr)) self.report({'INFO'}, tip_("Renamed %d of %d %s") % (change_len, total_len, descr))
return {'FINISHED'} return {'FINISHED'}

View File

@@ -13,6 +13,8 @@ from bl_ui.properties_physics_common import (
effector_weights_ui, effector_weights_ui,
) )
from bpy.app.translations import pgettext_iface as iface_
class SCENE_UL_keying_set_paths(UIList): class SCENE_UL_keying_set_paths(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
@@ -82,17 +84,17 @@ class SceneKeyingSetsPanel:
@staticmethod @staticmethod
def draw_keyframing_settings(context, layout, ks, ksp): def draw_keyframing_settings(context, layout, ks, ksp):
SceneKeyingSetsPanel._draw_keyframing_setting( SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "Needed", context, layout, ks, ksp, iface_("Needed"),
"use_insertkey_override_needed", "use_insertkey_needed", "use_insertkey_override_needed", "use_insertkey_needed",
userpref_fallback="use_keyframe_insert_needed", userpref_fallback="use_keyframe_insert_needed",
) )
SceneKeyingSetsPanel._draw_keyframing_setting( SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "Visual", context, layout, ks, ksp, iface_("Visual"),
"use_insertkey_override_visual", "use_insertkey_visual", "use_insertkey_override_visual", "use_insertkey_visual",
userpref_fallback="use_visual_keying", userpref_fallback="use_visual_keying",
) )
SceneKeyingSetsPanel._draw_keyframing_setting( SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "XYZ to RGB", context, layout, ks, ksp, iface_("XYZ to RGB"),
"use_insertkey_override_xyz_to_rgb", "use_insertkey_xyz_to_rgb", "use_insertkey_override_xyz_to_rgb", "use_insertkey_xyz_to_rgb",
) )

View File

@@ -5,6 +5,7 @@ from bpy.types import (
) )
from bpy.app.translations import pgettext_tip as tip_ from bpy.app.translations import pgettext_tip as tip_
from bpy.app.translations import pgettext_iface as iface_
__all__ = ( __all__ = (
"ToolDef", "ToolDef",
@@ -794,7 +795,7 @@ class ToolSelectPanelHelper:
# Note: we could show 'item.text' here but it makes the layout jitter when switching tools. # Note: we could show 'item.text' here but it makes the layout jitter when switching tools.
# Add some spacing since the icon is currently assuming regular small icon size. # Add some spacing since the icon is currently assuming regular small icon size.
if show_tool_icon_always: if show_tool_icon_always:
layout.label(text=" " + item.label, icon_value=icon_value) layout.label(text=" " + iface_(item.label, "Operator"), icon_value=icon_value)
layout.separator() layout.separator()
else: else:
if context.space_data.show_region_toolbar: if context.space_data.show_region_toolbar:
@@ -825,7 +826,7 @@ class ToolSelectPanelHelper:
row.label(text="Drag:") row.label(text="Drag:")
row = split.row() row = split.row()
row.context_pointer_set("tool", tool) row.context_pointer_set("tool", tool)
row.popover(panel="TOPBAR_PT_tool_fallback", text=label) row.popover(panel="TOPBAR_PT_tool_fallback", text=iface_(label, "Operator"))
return tool return tool

View File

@@ -2,6 +2,8 @@
import bpy import bpy
from bpy.types import Header, Menu, Panel from bpy.types import Header, Menu, Panel
from bpy.app.translations import pgettext_iface as iface_
class TOPBAR_HT_upper_bar(Header): class TOPBAR_HT_upper_bar(Header):
bl_space_type = 'TOPBAR' bl_space_type = 'TOPBAR'
@@ -363,7 +365,7 @@ class TOPBAR_MT_file_new(Menu):
for d in paths: for d in paths:
props = layout.operator( props = layout.operator(
"wm.read_homefile", "wm.read_homefile",
text=bpy.path.display_name(d), text=bpy.path.display_name(iface_(d)),
icon=icon, icon=icon,
) )
props.app_template = d props.app_template = d

View File

@@ -710,10 +710,10 @@ void BKE_collection_new_name_get(Collection *collection_parent, char *rname)
char *name; char *name;
if (!collection_parent) { if (!collection_parent) {
name = BLI_strdup("Collection"); name = BLI_strdup(DATA_("Collection"));
} }
else if (collection_parent->flag & COLLECTION_IS_MASTER) { else if (collection_parent->flag & COLLECTION_IS_MASTER) {
name = BLI_sprintfN("Collection %d", BLI_listbase_count(&collection_parent->children) + 1); name = BLI_sprintfN(DATA_("Collection %d"), BLI_listbase_count(&collection_parent->children) + 1);
} }
else { else {
const int number = BLI_listbase_count(&collection_parent->children) + 1; const int number = BLI_listbase_count(&collection_parent->children) + 1;

View File

@@ -675,7 +675,7 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd,
} }
/* auto-name */ /* auto-name */
BLI_strncpy(gpl->info, name, sizeof(gpl->info)); BLI_strncpy(gpl->info, DATA_(name), sizeof(gpl->info));
BLI_uniquename(&gpd->layers, BLI_uniquename(&gpd->layers,
gpl, gpl,
(gpd->flag & GP_DATA_ANNOTATIONS) ? DATA_("Note") : DATA_("GP_Layer"), (gpd->flag & GP_DATA_ANNOTATIONS) ? DATA_("Note") : DATA_("GP_Layer"),

View File

@@ -56,6 +56,8 @@
#include "BLO_readfile.h" #include "BLO_readfile.h"
#include "BLT_translation.h"
#include "versioning_common.h" #include "versioning_common.h"
/* Make preferences read-only, use versioning_userdef.c. */ /* Make preferences read-only, use versioning_userdef.c. */
@@ -65,7 +67,7 @@ static bool blo_is_builtin_template(const char *app_template)
{ {
/* For all builtin templates shipped with Blender. */ /* For all builtin templates shipped with Blender. */
return (!app_template || return (!app_template ||
STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", "Video_Editing")); STR_ELEM(app_template, N_("2D_Animation"), N_("Sculpting"), N_("VFX"), N_("Video_Editing")));
} }
static void blo_update_defaults_screen(bScreen *screen, static void blo_update_defaults_screen(bScreen *screen,

View File

@@ -19,6 +19,8 @@
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BLT_translation.h"
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "ED_gpencil.h" #include "ED_gpencil.h"
@@ -34,7 +36,7 @@ typedef struct ColorTemplate {
static int gpencil_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct) static int gpencil_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct)
{ {
int index; int index;
Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, pct->name, &index); Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, DATA_(pct->name), &index);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba);
@@ -52,7 +54,7 @@ static int gpencil_stroke_material(Main *bmain, Object *ob, const ColorTemplate
/* Color Data */ /* Color Data */
static const ColorTemplate gp_stroke_material_black = { static const ColorTemplate gp_stroke_material_black = {
"Black", N_("Black"),
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };

View File

@@ -21,6 +21,8 @@
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BLT_translation.h"
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h" #include "DEG_depsgraph_query.h"
@@ -40,7 +42,7 @@ static int gpencil_lineart_material(Main *bmain,
const bool fill) const bool fill)
{ {
int index; int index;
Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, pct->name, &index); Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, DATA_(pct->name), &index);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba);
@@ -59,7 +61,7 @@ static int gpencil_lineart_material(Main *bmain,
/* Color Data */ /* Color Data */
static const ColorTemplate gp_stroke_material_black = { static const ColorTemplate gp_stroke_material_black = {
"Black", N_("Black"),
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };

View File

@@ -19,6 +19,8 @@
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BLT_translation.h"
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "ED_gpencil.h" #include "ED_gpencil.h"
@@ -54,7 +56,7 @@ static int gpencil_monkey_color(
Main *bmain, Object *ob, const ColorTemplate *pct, bool stroke, bool fill) Main *bmain, Object *ob, const ColorTemplate *pct, bool stroke, bool fill)
{ {
int index; int index;
Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, pct->name, &index); Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, DATA_(pct->name), &index);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba);
@@ -781,37 +783,37 @@ static const float data27[33 * GP_PRIM_DATABUF_SIZE] = {
/* Monkey Color Data */ /* Monkey Color Data */
static const ColorTemplate gp_monkey_pct_black = { static const ColorTemplate gp_monkey_pct_black = {
"Black", N_("Black"),
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_monkey_pct_skin = { static const ColorTemplate gp_monkey_pct_skin = {
"Skin", N_("Skin"),
{0.733f, 0.569f, 0.361f, 1.0f}, {0.733f, 0.569f, 0.361f, 1.0f},
{0.745f, 0.502f, 0.278f, 1.0f}, {0.745f, 0.502f, 0.278f, 1.0f},
}; };
static const ColorTemplate gp_monkey_pct_skin_light = { static const ColorTemplate gp_monkey_pct_skin_light = {
"Skin_Light", N_("Skin_Light"),
{0.914f, 0.827f, 0.635f, 1.0f}, {0.914f, 0.827f, 0.635f, 1.0f},
{0.913f, 0.828f, 0.637f, 0.0f}, {0.913f, 0.828f, 0.637f, 0.0f},
}; };
static const ColorTemplate gp_monkey_pct_skin_shadow = { static const ColorTemplate gp_monkey_pct_skin_shadow = {
"Skin_Shadow", N_("Skin_Shadow"),
{0.322f, 0.29f, 0.224f, 0.5f}, {0.322f, 0.29f, 0.224f, 0.5f},
{0.32f, 0.29f, 0.223f, 0.3f}, {0.32f, 0.29f, 0.223f, 0.3f},
}; };
static const ColorTemplate gp_monkey_pct_eyes = { static const ColorTemplate gp_monkey_pct_eyes = {
"Eyes", N_("Eyes"),
{0.553f, 0.39f, 0.266f, 0.0f}, {0.553f, 0.39f, 0.266f, 0.0f},
{0.847f, 0.723f, 0.599f, 1.0f}, {0.847f, 0.723f, 0.599f, 1.0f},
}; };
static const ColorTemplate gp_monkey_pct_pupils = { static const ColorTemplate gp_monkey_pct_pupils = {
"Pupils", N_("Pupils"),
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f},
}; };

View File

@@ -19,6 +19,8 @@
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BLT_translation.h"
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "ED_gpencil.h" #include "ED_gpencil.h"
@@ -37,7 +39,7 @@ static int gpencil_stroke_material(Main *bmain,
const bool fill) const bool fill)
{ {
int index; int index;
Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, pct->name, &index); Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, DATA_(pct->name), &index);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba);
@@ -150,37 +152,37 @@ static const float data0[175 * GP_PRIM_DATABUF_SIZE] = {
/* Color Data */ /* Color Data */
static const ColorTemplate gp_stroke_material_black = { static const ColorTemplate gp_stroke_material_black = {
"Black", N_("Black"),
{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_stroke_material_white = { static const ColorTemplate gp_stroke_material_white = {
"White", N_("White"),
{1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_stroke_material_red = { static const ColorTemplate gp_stroke_material_red = {
"Red", N_("Red"),
{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_stroke_material_green = { static const ColorTemplate gp_stroke_material_green = {
"Green", N_("Green"),
{0.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_stroke_material_blue = { static const ColorTemplate gp_stroke_material_blue = {
"Blue", N_("Blue"),
{0.0f, 0.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 1.0f, 1.0f},
{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
}; };
static const ColorTemplate gp_stroke_material_grey = { static const ColorTemplate gp_stroke_material_grey = {
"Grey", N_("Grey"),
{0.358f, 0.358f, 0.358f, 1.0f}, {0.358f, 0.358f, 0.358f, 1.0f},
{0.5f, 0.5f, 0.5f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f},
}; };

View File

@@ -273,7 +273,7 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
PointerRNA ptr, idptr; PointerRNA ptr, idptr;
PropertyRNA *prop; PropertyRNA *prop;
text = BKE_text_add(bmain, "Text"); text = BKE_text_add(bmain, DATA_("Text"));
/* hook into UI */ /* hook into UI */
UI_context_active_but_prop_get_templateID(C, &ptr, &prop); UI_context_active_but_prop_get_templateID(C, &ptr, &prop);