Fix/Cleanup: I18N: Bad usage of IFACE_ instead of TIP_.
[blender.git] / source / blender / editors / gpencil / gpencil_primitive.c
index bff17bf5078a0299376d9dbd9c5115cbc450dc19..b10801fc87f271f67e9a4d71ff6415b9e24e42fb 100644 (file)
@@ -305,21 +305,11 @@ static void gpencil_primitive_allocate_memory(tGPDprimitive *tgpi)
 /* Helper: Create internal strokes primitives data */
 static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
 {
-  ToolSettings *ts = CTX_data_tool_settings(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   int cfra_eval = (int)DEG_get_ctime(depsgraph);
 
   bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
 
-  /* if brush doesn't exist, create a new one */
-  Paint *paint = &ts->gp_paint->paint;
-  /* if not exist, create a new one */
-  if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
-    /* create new brushes */
-    BKE_brush_gpencil_presets(C);
-  }
-  tgpi->brush = paint->brush;
-
   /* if layer doesn't exist, create a new one */
   if (gpl == NULL) {
     gpl = BKE_gpencil_layer_addnew(tgpi->gpd, DATA_("Primitives"), true);
@@ -410,32 +400,32 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
 
   if (tgpi->type == GP_STROKE_LINE) {
     BLI_strncpy(msg_str,
-                IFACE_("Line: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- to "
-                       "adjust subdivision number, Shift to align, Alt to center, E: extrude"),
+                TIP_("Line: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- to "
+                     "adjust subdivision number, Shift to align, Alt to center, E: extrude"),
                 UI_MAX_DRAW_STR);
   }
   else if (tgpi->type == GP_STROKE_BOX) {
     BLI_strncpy(msg_str,
-                IFACE_("Rectangle: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- "
-                       "to adjust subdivision number, Shift to square, Alt to center"),
+                TIP_("Rectangle: ESC to cancel, LMB set origin, Enter/MMB to confirm, WHEEL/+- "
+                     "to adjust subdivision number, Shift to square, Alt to center"),
                 UI_MAX_DRAW_STR);
   }
   else if (tgpi->type == GP_STROKE_CIRCLE) {
     BLI_strncpy(msg_str,
-                IFACE_("Circle: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge "
-                       "number, Shift to square, Alt to center"),
+                TIP_("Circle: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge "
+                     "number, Shift to square, Alt to center"),
                 UI_MAX_DRAW_STR);
   }
   else if (tgpi->type == GP_STROKE_ARC) {
     BLI_strncpy(msg_str,
-                IFACE_("Arc: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, "
-                       "Shift to square, Alt to center, M: Flip, E: extrude"),
+                TIP_("Arc: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge number, "
+                     "Shift to square, Alt to center, M: Flip, E: extrude"),
                 UI_MAX_DRAW_STR);
   }
   else if (tgpi->type == GP_STROKE_CURVE) {
     BLI_strncpy(msg_str,
-                IFACE_("Curve: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge "
-                       "number, Shift to square, Alt to center, E: extrude"),
+                TIP_("Curve: ESC to cancel, Enter/MMB to confirm, WHEEL/+- to adjust edge "
+                     "number, Shift to square, Alt to center, E: extrude"),
                 UI_MAX_DRAW_STR);
   }
 
@@ -1106,6 +1096,8 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
   Main *bmain = CTX_data_main(C);
   Scene *scene = CTX_data_scene(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
+  Paint *paint = &ts->gp_paint->paint;
+
   int cfra_eval = (int)DEG_get_ctime(depsgraph);
 
   /* create temporary operator data */
@@ -1136,6 +1128,12 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
   /* region where paint was originated */
   tgpi->gpd->runtime.ar = tgpi->ar;
 
+  /* if brush doesn't exist, create a new set (fix damaged files from old versions) */
+  if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
+    BKE_brush_gpencil_presets(C);
+  }
+  tgpi->brush = paint->brush;
+
   /* control points */
   tgpi->gpd->runtime.cp_points = MEM_callocN(sizeof(bGPDcontrolpoint) * MAX_CP,
                                              "gp primitive cpoint");