[Bf-blender-cvs] [474f5a98197] soc-2019-bevel-profiles: Naming (ProfileWidget to ProfileCurve)

Hans Goudey noreply at git.blender.org
Tue Oct 15 19:05:37 CEST 2019


Commit: 474f5a9819747915b8159639b6d80c1023d65171
Author: Hans Goudey
Date:   Tue Oct 15 13:04:59 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB474f5a9819747915b8159639b6d80c1023d65171

Naming (ProfileWidget to ProfileCurve)

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/CMakeLists.txt
R053	source/blender/blenkernel/BKE_profile_widget.h	source/blender/blenkernel/BKE_profile_curve.h
M	source/blender/blenkernel/CMakeLists.txt
R070	source/blender/blenkernel/intern/profile_widget.c	source/blender/blenkernel/intern/profile_curve.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/bmesh/operators/bmo_bevel.c
M	source/blender/bmesh/tools/bmesh_bevel.c
M	source/blender/bmesh/tools/bmesh_bevel.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/makesdna/DNA_modifier_types.h
R084	source/blender/makesdna/DNA_profilewidget_types.h	source/blender/makesdna/DNA_profilecurve_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_modifier.c
R073	source/blender/makesrna/intern/rna_profile.c	source/blender/makesrna/intern/rna_profilecurve.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_ui_api.c
M	source/blender/modifiers/intern/MOD_bevel.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 956a2bccfe1..cc47c4d631c 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -180,11 +180,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         row = layout.row()
         row.enabled = md.use_custom_profile
         if md.use_custom_profile:
-            layout.template_profilewidget(md, "prwdgt")
+            layout.template_profilecurve(md, "custom_profile")
             # If the number of segments has changed, update the table to show the new sampled
             # segment locations on the widget
-            if md.prwdgt.totsegments != md.segments:
-                md.prwdgt.initialize(md.segments)
+            if md.custom_profile.totsegments != md.segments:
+                md.custom_profile.initialize(md.segments)
 
     def BOOLEAN(self, layout, _ob, md):
         split = layout.split()
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 0297a858eae..c4f22351b76 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -68,7 +68,7 @@ set(SRC_DNA_INC
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_profilewidget_types.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_profilecurve_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_rigidbody_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_types.h
   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_screen_types.h
diff --git a/source/blender/blenkernel/BKE_profile_widget.h b/source/blender/blenkernel/BKE_profile_curve.h
similarity index 53%
rename from source/blender/blenkernel/BKE_profile_widget.h
rename to source/blender/blenkernel/BKE_profile_curve.h
index c5358b3dbd7..af04c9016fc 100644
--- a/source/blender/blenkernel/BKE_profile_widget.h
+++ b/source/blender/blenkernel/BKE_profile_curve.h
@@ -17,59 +17,59 @@
  * All rights reserved.
  */
 
-#ifndef BKE_PROFILEPATH_H
-#define BKE_PROFILEPATH_H
+#ifndef __BKE_PROFILEPATH_H__
+#define __BKE_PROFILEPATH_H__
 
 /** \file
  * \ingroup bke
  */
 
-struct ProfileWidget;
+struct ProfileCurve;
 struct ProfilePoint;
 
-void BKE_profilewidget_set_defaults(struct ProfileWidget *prwdgt);
+void BKE_profilecurve_set_defaults(struct ProfileCurve *prwdgt);
 
-struct ProfileWidget *BKE_profilewidget_add(int preset);
+struct ProfileCurve *BKE_profilecurve_add(int preset);
 
-void BKE_profilewidget_free_data(struct ProfileWidget *prwdgt);
+void BKE_profilecurve_free_data(struct ProfileCurve *prwdgt);
 
-void BKE_profilewidget_free(struct ProfileWidget *prwdgt);
+void BKE_profilecurve_free(struct ProfileCurve *prwdgt);
 
-void BKE_profilewidget_copy_data(struct ProfileWidget *target, const struct ProfileWidget *prwdgt);
+void BKE_profilecurve_copy_data(struct ProfileCurve *target, const struct ProfileCurve *prwdgt);
 
-struct ProfileWidget *BKE_profilewidget_copy(const struct ProfileWidget *prwdgt);
+struct ProfileCurve *BKE_profilecurve_copy(const struct ProfileCurve *prwdgt);
 
-bool BKE_profilewidget_remove_point(struct ProfileWidget *prwdgt, struct ProfilePoint *point);
+bool BKE_profilecurve_remove_point(struct ProfileCurve *prwdgt, struct ProfilePoint *point);
 
-void BKE_profilewidget_remove(struct ProfileWidget *prwdgt, const short flag);
+void BKE_profilecurve_remove_by_flag(struct ProfileCurve *prwdgt, const short flag);
 
-struct ProfilePoint *BKE_profilewidget_insert(struct ProfileWidget *prwdgt, float x, float y);
+struct ProfilePoint *BKE_profilecurve_insert(struct ProfileCurve *prwdgt, float x, float y);
 
-void BKE_profilewidget_handle_set(struct ProfileWidget *prwdgt, int type);
+void BKE_profilecurve_handle_set(struct ProfileCurve *prwdgt, int type_1, int type_2);
 
-void BKE_profilewidget_reverse(struct ProfileWidget *prwdgt);
+void BKE_profilecurve_reverse(struct ProfileCurve *prwdgt);
 
-void BKE_profilewidget_reset(struct ProfileWidget *prwdgt);
+void BKE_profilecurve_reset(struct ProfileCurve *prwdgt);
 
-void BKE_profilewidget_create_samples(struct ProfileWidget *prwdgt,
+void BKE_profilecurve_create_samples(struct ProfileCurve *prwdgt,
                                       int n_segments,
                                       bool sample_straight_edges,
                                       struct ProfilePoint *r_samples);
 
-void BKE_profilewidget_initialize(struct ProfileWidget *prwdgt, short nsegments);
+void BKE_profilecurve_initialize(struct ProfileCurve *prwdgt, short nsegments);
 
 /* Called for a complete update of the widget after modifications */
-void BKE_profilewidget_changed(struct ProfileWidget *prwdgt, const bool rem_doubles);
+void BKE_profilecurve_update(struct ProfileCurve *prwdgt, const bool rem_doubles);
 
 /* Need to find the total length of the curve to sample a portion of it */
-float BKE_profilewidget_total_length(const struct ProfileWidget *prwdgt);
+float BKE_profilecurve_total_length(const struct ProfileCurve *prwdgt);
 
-void BKE_profilewidget_create_samples_even_spacing(struct ProfileWidget *prwdgt,
+void BKE_profilecurve_create_samples_even_spacing(struct ProfileCurve *prwdgt,
                                                    int n_segments,
                                                    struct ProfilePoint *r_samples);
 
 /* Length portion is the fraction of the total path length where we want the location */
-void BKE_profilewidget_evaluate_length_portion(const struct ProfileWidget *prwdgt,
+void BKE_profilecurve_evaluate_length_portion(const struct ProfileCurve *prwdgt,
                                                float length_portion,
                                                float *x_out,
                                                float *y_out);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index b1e5a3fec00..a7a4c5be6e8 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -185,7 +185,7 @@ set(SRC
   intern/pbvh_bmesh.c
   intern/pbvh_parallel.cc
   intern/pointcache.c
-  intern/profile_widget.c
+  intern/profile_curve.c
   intern/report.c
   intern/rigidbody.c
   intern/scene.c
@@ -331,7 +331,7 @@ set(SRC
   BKE_particle.h
   BKE_pbvh.h
   BKE_pointcache.h
-  BKE_profile_widget.h
+  BKE_profile_curve.h
   BKE_report.h
   BKE_rigidbody.h
   BKE_scene.h
diff --git a/source/blender/blenkernel/intern/profile_widget.c b/source/blender/blenkernel/intern/profile_curve.c
similarity index 70%
rename from source/blender/blenkernel/intern/profile_widget.c
rename to source/blender/blenkernel/intern/profile_curve.c
index b02e0d65f8d..ca4a2addcc8 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_curve.c
@@ -28,7 +28,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "DNA_profilewidget_types.h"
+#include "DNA_profilecurve_types.h"
 #include "DNA_curve_types.h"
 
 #include "BLI_blenlib.h"
@@ -37,100 +37,83 @@
 #include "BLI_task.h"
 #include "BLI_threads.h"
 
-#include "BKE_profile_widget.h"
+#include "BKE_profile_curve.h"
 #include "BKE_curve.h"
 #include "BKE_fcurve.h"
 
-void BKE_profilewidget_free_data(ProfileWidget *prwdgt)
+void BKE_profilecurve_free_data(ProfileCurve *prwdgt)
 {
-  if (prwdgt->path) {
-    MEM_freeN(prwdgt->path);
-    prwdgt->path = NULL;
-  }
-  if (prwdgt->table) {
-    MEM_freeN(prwdgt->table);
-    prwdgt->table = NULL;
-  }
-  if (prwdgt->segments) {
-    MEM_freeN(prwdgt->segments);
-    prwdgt->segments = NULL;
-  }
+  MEM_SAFE_FREE(prwdgt->path);
+  MEM_SAFE_FREE(prwdgt->table);
+  MEM_SAFE_FREE(prwdgt->segments);
 }
 
-void BKE_profilewidget_free(ProfileWidget *prwdgt)
+void BKE_profilecurve_free(ProfileCurve *prwdgt)
 {
   if (prwdgt) {
-    BKE_profilewidget_free_data(prwdgt);
+    BKE_profilecurve_free_data(prwdgt);
     MEM_freeN(prwdgt);
   }
 }
 
-void BKE_profilewidget_copy_data(ProfileWidget *target, const ProfileWidget *prwdgt)
+void BKE_profilecurve_copy_data(ProfileCurve *target, const ProfileCurve *prwdgt)
 {
   *target = *prwdgt;
 
-  if (prwdgt->path) {
-    target->path = MEM_dupallocN(prwdgt->path);
-  }
-  if (prwdgt->table) {
-    target->table = MEM_dupallocN(prwdgt->table);
-  }
-  if (prwdgt->segments) {
-    target->segments = MEM_dupallocN(prwdgt->segments);
-  }
+  target->path = MEM_dupallocN(prwdgt->path);
+  target->table = MEM_dupallocN(prwdgt->table);
+  target->segments = MEM_dupallocN(prwdgt->segments);
 }
 
-ProfileWidget *BKE_profilewidget_copy(const ProfileWidget *prwdgt)
+ProfileCurve *BKE_profilecurve_copy(const ProfileCurve *prwdgt)
 {
   if (prwdgt) {
-    ProfileWidget *new_prdgt = MEM_dupallocN(prwdgt);
-    BKE_profilewidget_copy_data(new_prdgt, prwdgt);
+    ProfileCurve *new_prdgt = MEM_dupallocN(prwdgt);
+    BKE_profilecurve_copy_data(new_prdgt, prwdgt);
     return new_prdgt;
   }
   return NULL;
 }
 
 /** Removes a specific point from the path of control points.
- * \note: Requires profilewidget_changed call after. */
-bool BKE_profilewidget_remove_point(ProfileWidget *prwdgt, ProfilePoint *point)
+ * \note: Requires profilecurve_update call after. */
+bool BKE_profilecurve_remove_point(ProfileCurve *prwdgt, ProfilePoint *point)
 {
   ProfilePoint *pts;
-  int i_old, i_new, n_removed = 0;
 
   /* Must have 2 points minimum. */
   if (prwdgt->totpoint <= 2) {
     return false;
   }
 
-  pts = MEM_mallocN((size_t)prwdgt->totpoint * sizeof(ProfilePoint), "path points");
-
-  /* Build the new list without the point when it's found. Keep the first and last points. */
-  for (i_old = 1, i_new = 0; i_old < prwdgt->totpoint - 1; i_old++) {
-    if (&prwdgt->path[i_old] != point) {
-      pts[i_new] = prwdgt->path[i_old];
-      i_new++;
-    }
-    else {
-      n_removed++;
-    }
+  /* Input point must be within the array. */
+  if (!(point > prwdgt->path && point < prwdgt->path + prwdgt->totpoint)) {
+    return false;
   }
 
+  pts = MEM_mallocN(sizeof(ProfilePoint) * prwdgt->totpoint, "path po

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list