[Bf-blender-cvs] [625a3a113a6] soc-2019-bevel-profiles: Many changes, mostly profile widget sampling: - Added new sampling method to profile widget for curves. - Flipped X orientation of profile in profile widget - Small UI changes to profile widget code - Removed "Sample Only Points" option as its functionality is now accessible by setting the number of segments correctly - Cleanup in profile_widget.c. Progressing towards final code there
Hans Goudey
noreply at git.blender.org
Sat Jul 6 07:31:27 CEST 2019
Commit: 625a3a113a68b59f6c66e944562b86049dcdc0f4
Author: Hans Goudey
Date: Sat Jul 6 01:28:15 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB625a3a113a68b59f6c66e944562b86049dcdc0f4
Many changes, mostly profile widget sampling:
- Added new sampling method to profile widget for curves.
- Flipped X orientation of profile in profile widget
- Small UI changes to profile widget code
- Removed "Sample Only Points" option as its functionality is now
accessible by setting the number of segments correctly
- Cleanup in profile_widget.c. Progressing towards final code there
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/blenkernel/BKE_profile_widget.h
M source/blender/blenkernel/intern/modifier.c
M source/blender/blenkernel/intern/profile_widget.c
M source/blender/blenloader/intern/readfile.c
M source/blender/bmesh/intern/bmesh_opdefines.c
M source/blender/bmesh/intern/bmesh_operator_api.h
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/interface/interface_draw.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
M source/blender/makesdna/DNA_profilewidget_types.h
M source/blender/makesrna/intern/rna_modifier.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 ea75834a204..0636d69258a 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -163,18 +163,17 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.label(text="Width Method:")
layout.row().prop(md, "offset_type", expand=True)
- layout.label(text="Set Face Strength Mode")
- layout.row().prop(md, "face_strength_mode", expand=True)
+ layout.row().prop(md, "face_strength_mode", expand=False)
layout.label(text="Miter Patterns")
layout.row().prop(md, "miter_outer")
layout.row().prop(md, "miter_inner")
- layout.row().prop(md, "spread")
+ if md.miter_inner == 'MITER_PATCH' or md.miter_inner == 'MITER_ARC':
+ layout.row().prop(md, "spread")
layout.row().prop(md, "use_custom_profile")
if md.use_custom_profile:
layout.template_profilewidget(md, "prwdgt")
- layout.row().prop(md, "sample_points")
def BOOLEAN(self, layout, _ob, md):
split = layout.split()
diff --git a/source/blender/blenkernel/BKE_profile_widget.h b/source/blender/blenkernel/BKE_profile_widget.h
index 93fbdcf2b78..d0c8651d6f1 100644
--- a/source/blender/blenkernel/BKE_profile_widget.h
+++ b/source/blender/blenkernel/BKE_profile_widget.h
@@ -16,7 +16,7 @@
* Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-/* HANS-TODO: Check right copyright info for new files */
+
#ifndef BKE_PROFILEPATH_H
#define BKE_PROFILEPATH_H
@@ -41,6 +41,8 @@ void profilewidget_copy_data(struct ProfileWidget *target, const struct ProfileW
struct ProfileWidget *profilewidget_copy(const struct ProfileWidget *prwdgt);
+void profilewidget_create_samples(const struct ProfileWidget *prwdgt, float *locations, int n_segments);
+
/* Evaluates along the length of the path rather than with X coord */
void profilewidget_evaluate(const struct ProfileWidget *prwdgt,
int segment,
@@ -53,11 +55,13 @@ void profilewidget_evaluate_portion(const struct ProfileWidget *prwdgt,
float *x_out,
float *y_out);
+void profilewidget_initialize(struct ProfileWidget *prwdgt, short nsegments);
+
/* Need to find the total length of the curve to sample a portion of it */
float profilewidget_total_length(const struct ProfileWidget *prwdgt);
/* Distance in 2D to the next point */
-float profilewidget_linear_distance_to_next_point(const struct ProfileWidget *prwdgt, int i);
+float profilewidget_distance_to_next_point(const struct ProfileWidget *prwdgt, int i);
void profilewidget_reset(struct ProfileWidget *prwdgt);
@@ -75,9 +79,6 @@ void profilewidget_handle_set(struct ProfileWidget *prwdgt, int type);
/* Called for a complete update of the widget after modifications */
void profilewidget_changed(struct ProfileWidget *prwdgt, const bool rem_doubles);
-/* call before all evaluation functions */
-void profilewidget_initialize(struct ProfileWidget *prwdgt, int nsegments);
-
void profilewidget_fill_segment_table(const struct ProfileWidget *prwdgt,
double *x_table_out,
double *y_table_out);
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index f2246bb3bd4..a86085942bf 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -154,7 +154,6 @@ static void modifier_free_data_id_us_cb(void *UNUSED(userData),
void modifier_free_ex(ModifierData *md, const int flag)
{
- printf("MODIFIER FREE EX\n");
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
@@ -903,7 +902,6 @@ struct Mesh *modwrap_applyModifier(ModifierData *md,
const ModifierEvalContext *ctx,
struct Mesh *me)
{
- printf("MODWRAP APPLY MODIFIER\n");
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
BLI_assert(CustomData_has_layer(&me->pdata, CD_NORMAL) == false);
diff --git a/source/blender/blenkernel/intern/profile_widget.c b/source/blender/blenkernel/intern/profile_widget.c
index bd3cb093e55..aa15e80100c 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -41,12 +41,13 @@
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#define DEBUG_PRWDGT 1
-#define DEBUG_PRWDGT_TABLE 1
+#define DEBUG_PRWDGT 0
+#define DEBUG_PRWDGT_TABLE 0
#define DEBUG_PRWDGT_EVALUATE 0
#define DEBUG_PRWDGT_REVERSE 0
/* HANS-TODO: Organize functions, especially by which need initialization and which don't */
+/* HANS-TODO: Make sure the stupid asserts I've used as sanity checks aren't making it to release builds */
void profilewidget_set_defaults(ProfileWidget *prwdgt)
{
@@ -89,21 +90,22 @@ void profilewidget_free_data(ProfileWidget *prwdgt)
{
#if DEBUG_PRWDGT
printf("PROFILEWIDGET FREE DATA\n");
+ if (!prwdgt->path) {
+ printf("The prwdgt had no path... probably a second redundant free call\n");
+ }
#endif
-
if (prwdgt->path) {
MEM_freeN(prwdgt->path);
prwdgt->path = NULL;
}
- else {
-#if DEBUG_PRWDGT
- printf("The prwdgt had no path... probably a second redundant free call\n");
-#endif
- }
if (prwdgt->table) {
MEM_freeN(prwdgt->table);
prwdgt->table = NULL;
}
+ if (prwdgt->samples) {
+ MEM_freeN(prwdgt->samples);
+ prwdgt->samples = NULL;
+ }
}
void profilewidget_free(ProfileWidget *prwdgt)
@@ -130,6 +132,9 @@ void profilewidget_copy_data(ProfileWidget *target, const ProfileWidget *prwdgt)
if (prwdgt->table) {
target->table = MEM_dupallocN(prwdgt->table);
}
+ if (prwdgt->samples) {
+ target->samples = MEM_dupallocN(prwdgt->samples);
+ }
}
ProfileWidget *profilewidget_copy(const ProfileWidget *prwdgt)
@@ -218,16 +223,20 @@ void profilewidget_remove(ProfileWidget *prwdgt, const short flag)
*/
ProfilePoint *profilewidget_insert(ProfileWidget *prwdgt, float x, float y)
{
- ProfilePoint *new_pt;
+ ProfilePoint *new_pt = NULL;
float new_loc[2] = {x, y};
#if DEBUG_PRWDGT
printf("PROFILEPATH INSERT\n");
#endif
+ if (prwdgt->totpoint == PROF_TABLE_SIZE - 1) {
+ return NULL;
+ }
+
/* Find the index at the line segment that's closest to the new position */
float distance;
float min_distance = FLT_MAX;
- int insert_i;
+ int insert_i = 0;
for (int i = 0; i < prwdgt->totpoint - 1; i++) {
float loc1[2] = {prwdgt->path[i].x, prwdgt->path[i].y};
float loc2[2] = {prwdgt->path[i + 1].x, prwdgt->path[i + 1].y};
@@ -279,16 +288,17 @@ void profilewidget_reverse(ProfileWidget *prwdgt)
}
ProfilePoint *new_pts = MEM_mallocN(((size_t)prwdgt->totpoint) * sizeof(ProfilePoint),
"path points");
- /* Mirror the new points across the y = 1 - x line */
+ /* Mirror the new points across the y = x line */
for (int i = 1; i < prwdgt->totpoint - 1; i++) {
- new_pts[prwdgt->totpoint - i - 1].x = 1.0f - prwdgt->path[i].y;
- new_pts[prwdgt->totpoint - i - 1].y = 1.0f - prwdgt->path[i].x;
+ new_pts[prwdgt->totpoint - i - 1].x = prwdgt->path[i].y;
+ new_pts[prwdgt->totpoint - i - 1].y = prwdgt->path[i].x;
new_pts[prwdgt->totpoint - i - 1].flag = prwdgt->path[i].flag;
}
/* Set the location of the first and last points */
- new_pts[0].x = 0.0;
+ /* HANS-TODO: Bring this into the loop */
+ new_pts[0].x = 1.0;
new_pts[0].y = 0.0;
- new_pts[prwdgt->totpoint - 1].x = 1.0;
+ new_pts[prwdgt->totpoint - 1].x = 0.0;
new_pts[prwdgt->totpoint - 1].y = 1.0;
#if DEBUG_PRWDGT_REVERSE
@@ -321,7 +331,6 @@ void profilewidget_reset(ProfileWidget *prwdgt)
}
int preset = prwdgt->preset;
-
switch (preset) {
case PROF_PRESET_LINE:
prwdgt->totpoint = 2;
@@ -338,74 +347,73 @@ void profilewidget_reset(ProfileWidget *prwdgt)
switch (preset) {
case PROF_PRESET_LINE:
- prwdgt->path[0].x = 0.0;
+ prwdgt->path[0].x = 1.0;
prwdgt->path[0].y = 0.0;
- prwdgt->path[1].x = 1.0;
+ prwdgt->path[1].x = 0.0;
prwdgt->path[1].y = 1.0;
break;
case PROF_PRESET_SUPPORTS:
- prwdgt->path[0].x = 0.0;
+ prwdgt->path[0].x = 1.0;
prwdgt->path[0].y = 0.0;
- prwdgt->path[1].x = 0.0;
+ prwdgt->path[1].x = 1.0;
prwdgt->path[1].y = 0.5;
for (int i = 1; i < 10; i++) {
- prwdgt->path[i + 1].x = 0.5f * (1.0f - cosf((float)((i / 9.0) * M_PI_2)));
+ prwdgt->path[i + 1].x = 1.0f - (0.5f * (1.0f - cosf((float)((i / 9.0) * M_PI_2))));
prwdgt->path[i + 1].y = 0.5f + 0.5f * sinf((float)((i / 9.0) * M_PI_2));
}
prwdgt->path[10].x = 0.5;
prwdgt->path[10].y = 1.0;
- prwdgt->path[11].x = 1.0;
+ prwdgt->path[11].x = 0.0;
prwdgt->path[11].y = 1.0;
break;
case PROF_PRESET_EXAMPLE1: /* HANS-TODO: Don't worry, this is just temporary */
- prwdgt->path[0].x = 0.0f;
+ prwdgt->path[0].x = 1.0f;
prwdgt->path[0].y = 0.0f;
- prwdgt->path[1].x = 0.0f;
+ prwdgt->path[1].x = 1.0f;
prwdgt->path[1].y = 0.6f;
- prwdgt->path[2].x = 0.1f;
+ prwdgt->path[2].x = 0.9f;
prwdgt->path[2].y = 0.6f;
- prwdgt->path[3].x = 0.1f;
+ prwdgt->path[3].x = 0.9f;
prwdgt->path[3].y = 0.7f;
- prwdgt->path[4].x = 0.195024f;
+ prwdgt->path[4].x = 1.0f - 0.195024f;
prwdgt->path[4].y = 0.709379f;
- prwdgt->path[5].x = 0.294767f;
+ prwdgt->path[5].x = 1.0f - 0.294767f;
prwdgt->path[5].y = 0.735585f;
- prwdgt->path[6].x = 0.369792f;
+ prwdgt->path[6].x = 1.0f - 0.369792f;
prwdgt->path[6].y = 0.775577f;
- prwdgt->path[7].x = 0.43429f;
+ prwdgt->path[7].x = 1.0f - 0.43429f;
prwdgt->path[7].y = 0.831837f;
- prwdgt->path[8].x = 0.500148f;
+ prwdgt->path[8].x = 1.0f - 0.500148f;
prwdgt->path[8].y = 0.884851f;
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list