[Bf-blender-cvs] [942f5b1] soc-2014-nurbs: Chrome improvements: shortcuts, trim select/drag, Shift-D, per-trim tessellation resolution, etc.
Jonathan deWerd
noreply at git.blender.org
Fri Aug 22 10:59:46 CEST 2014
Commit: 942f5b12df3545ea139fff199b3f32f9872764b5
Author: Jonathan deWerd
Date: Fri Aug 22 02:59:21 2014 -0600
Branches: soc-2014-nurbs
https://developer.blender.org/rB942f5b12df3545ea139fff199b3f32f9872764b5
Chrome improvements: shortcuts, trim select/drag, Shift-D, per-trim tessellation resolution, etc.
===================================================================
M release/scripts/startup/bl_ui/properties_data_curve.py
M release/scripts/startup/bl_ui/space_image.py
M source/blender/blenkernel/BKE_curve.h
M source/blender/blenkernel/intern/curve.cpp
M source/blender/editors/include/ED_uvedit.h
M source/blender/editors/space_api/spacetypes.c
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/uvedit/uvedit_draw.c
M source/blender/editors/uvedit/uvedit_ops.c
M source/blender/makesdna/DNA_curve_types.h
M source/blender/makesrna/intern/rna_curve.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index af22c88..ecf9e5c 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -296,7 +296,6 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
col.prop(act_spline, "radius_interpolation", text="Radius")
layout.prop(act_spline, "use_smooth")
- layout.prop(act_spline, "resolution_trim")
class DATA_PT_font(CurveButtonsPanelText, Panel):
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 2828d6d..076b581 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -143,9 +143,15 @@ class IMAGE_MT_trim(Menu):
bl_label = "Trim"
def draw(self, context):
layout = self.layout
+ layout.operator("uv.nurbsuv_delete_trim", text="Delete Trim")
+ layout.menu("IMAGE_MT_add")
+
+class IMAGE_MT_add(Menu):
+ bl_label = "Add"
+ def draw(self, context):
+ layout = self.layout
layout.operator("uv.nurbsuv_add_square", text="Square Trim", icon='MESH_PLANE')
layout.operator("uv.nurbsuv_add_circle", text="Circular Trim", icon='SURFACE_NCIRCLE')
- layout.operator("uv.nurbsuv_delete_trim", text="Delete Trim")
class IMAGE_MT_image(Menu):
bl_label = "Image"
@@ -585,6 +591,34 @@ class IMAGE_PT_game_properties(Panel):
col.separator()
col.prop(ima, "mapping", expand=True)
+class IMAGE_PT_view_nurbs(Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = 'NURBS:'
+
+ @classmethod
+ def poll(cls, context):
+ return context.space_data.show_nurbsuv
+
+ def draw(self, context):
+ layout = self.layout
+ split = layout.split()
+ col = split.column()
+ cu = context.edit_object.data
+ active_breakpt = cu.active_breakpt
+ active_trim = cu.active_trim
+ active_trim_nurb = cu.active_trim_nurb
+ if active_breakpt:
+ col.label(text="Active Breakpoint:")
+ col.prop(active_breakpt, "loc", text="Location")
+ col.prop(active_breakpt, "multiplicity", text="Multiplicity")
+ if active_trim:
+ col.label(text="Active Trim:")
+ sub = col.column()
+ sub.row().prop(active_trim, "type", expand=True)
+ if active_trim_nurb:
+ col.label(text="Active Trim Geometry:")
+ col.prop(active_trim_nurb, "resolution_u", text="Resolution:")
class IMAGE_PT_view_properties(Panel):
bl_space_type = 'IMAGE_EDITOR'
@@ -627,17 +661,6 @@ class IMAGE_PT_view_properties(Panel):
col.label("Cursor Location:")
col.row().prop(sima, "cursor_location", text="")
- if show_nurbsuv:
- col.separator()
- if context.edit_object.data.active_breakpt:
- col.label(text="Active Breakpoint:")
- col.prop(context.edit_object.data.active_breakpt, "loc", text="Location")
- col.prop(context.edit_object.data.active_breakpt, "multiplicity", text="Multiplicity")
- if context.edit_object.data.active_trim:
- col.label(text="Active Trim:")
- sub = col.column()
- sub.row().prop(context.edit_object.data.active_trim, "type", expand=True)
-
if show_uvedit:
col.separator()
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 78ef234..9a042c5 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -175,7 +175,7 @@ void BKE_nurbList_flag_set(ListBase *editnurb, short flag);
void BKE_nurbTrim_free(struct NurbTrim *nt);
struct NurbTrim *BKE_nurbTrim_duplicate(struct NurbTrim *nt);
-int BKE_nurbTrim_tess(struct NurbTrim *nt, int resolution, float (**uv)[2]); // Returns: # verts in uv
+int BKE_nurbTrim_tess(struct NurbTrim *nt, float (**uv)[2]); // Returns: # verts in uv
void BKE_nurbTrim_update_data(struct NurbTrim *nt);
void BKE_nurb_free(struct Nurb *nu);
diff --git a/source/blender/blenkernel/intern/curve.cpp b/source/blender/blenkernel/intern/curve.cpp
index 699a594..3179bc7 100644
--- a/source/blender/blenkernel/intern/curve.cpp
+++ b/source/blender/blenkernel/intern/curve.cpp
@@ -789,18 +789,18 @@ NurbTrim *BKE_nurbTrim_duplicate(NurbTrim *nt) {
return ret;
}
-int BKE_nurbTrim_tess(struct NurbTrim *nt, int resolution, float (**uv_out)[2]) {
+int BKE_nurbTrim_tess(struct NurbTrim *nt, float (**uv_out)[2]) {
int tot_tess_pts = 0;
for (Nurb* nu = (Nurb*)nt->nurb_list.first; nu; nu=nu->next) {
- int tess_pts = nu->pntsu * resolution + 1;
- if (nu->flagu&CU_NURB_ENDPOINT) tess_pts = (nu->pntsu+2-nu->orderu)*resolution;
+ int tess_pts = nu->pntsu * nu->resolu + 1;
+ if (nu->flagu&CU_NURB_ENDPOINT) tess_pts = (nu->pntsu+2-nu->orderu)*nu->resolu;
tot_tess_pts += tess_pts;
}
float (*uv)[2] = (float(*)[2])MEM_mallocN(sizeof(*uv)*tot_tess_pts, "BKE_nurbTrim_tess");
*uv_out = uv;
for (Nurb* nu = (Nurb*)nt->nurb_list.first; nu; nu=nu->next) {
- int tess_pts = nu->pntsu * resolution + 1;
- if (nu->flagu&CU_NURB_ENDPOINT) tess_pts = (nu->pntsu+2-nu->orderu)*resolution;
+ int tess_pts = nu->pntsu * nu->resolu + 1;
+ if (nu->flagu&CU_NURB_ENDPOINT) tess_pts = (nu->pntsu+2-nu->orderu)*nu->resolu;
float *U = nu->knotsu;
int pntsu = nu->pntsu;
BPoint *bp = nu->bp;
@@ -4248,11 +4248,10 @@ GridMesh *BKE_nurb_compute_trimmed_GridMesh(struct Nurb* nu) {
gm->init_grid(totu,totv);
// Trim
- if (nu->resol_trim<1) nu->resol_trim = 1;
// gm->begin_recording();
for (NurbTrim *nt=(NurbTrim*)nu->trims.first; nt; nt=nt->next) {
float (*trim_uv_pts)[2];
- int num_trimpts = BKE_nurbTrim_tess(nt, nu->resol_trim, &trim_uv_pts);
+ int num_trimpts = BKE_nurbTrim_tess(nt, &trim_uv_pts);
int trim_poly = gm->poly_new((float*)trim_uv_pts, num_trimpts*2);
switch (nt->type) {
case CU_TRIM_AND:
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 6e2adac..e11b888 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -49,6 +49,7 @@ struct wmKeyConfig;
/* uvedit_ops.c */
void ED_operatortypes_uvedit(void);
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
+void ED_operatormacros_uvedit(void);
void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
bool ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]);
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 83040a2..6ae2d2f 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -143,6 +143,7 @@ void ED_spacetypes_init(void)
ED_operatormacros_curve();
ED_operatormacros_mask();
ED_operatormacros_sequencer();
+ ED_operatormacros_uvedit();
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index aecaa65..73c0aed 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2591,6 +2591,7 @@ static void createTransUVsNURBS(bContext *C, TransInfo *t)
BPoint *pt;
int count=0,num_bp,i;
float aspx, aspy;
+ bool trim_selected;
/* First see how many trim control points + knots we will be dragging (count) */
for (nu=cu->editnurb->nurbs.first; nu; nu=nu->next) {
@@ -2600,10 +2601,11 @@ static void createTransUVsNURBS(bContext *C, TransInfo *t)
for (i=0; i<ek->num_breaksv; i++)
if (ek->breaksv[i].flag&SELECT) count++;
for (nt=nu->trims.first; nt; nt=nt->next) {
+ trim_selected = nt->flag & SELECT;
for (trimnu=nt->nurb_list.first; trimnu; trimnu=trimnu->next) {
num_bp = trimnu->pntsu * trimnu->pntsv;
for (i=0; i<num_bp; i++)
- if (trimnu->bp[i].f1 & SELECT) count++;
+ if (trimnu->bp[i].f1&SELECT || trim_selected) count++;
}
}
}
@@ -2652,11 +2654,12 @@ static void createTransUVsNURBS(bContext *C, TransInfo *t)
count += 1;
}
for (nt=nu->trims.first; nt; nt=nt->next) {
+ trim_selected = nt->flag & SELECT;
for (trimnu=nt->nurb_list.first; trimnu; trimnu=trimnu->next) {
num_bp = trimnu->pntsu * trimnu->pntsv;
for (i=0; i<num_bp; i++) {
pt = &trimnu->bp[i];
- if (pt->f1 & SELECT) {
+ if (pt->f1&SELECT || trim_selected) {
td = &t->data[count];
td2d = &t->data2d[count];
td2d->loc[0] = pt->vec[0];
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index b9a453e..e047f4f 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -1096,7 +1096,6 @@ static void draw_nurbuv(const struct bContext *C, ARegion *ar, Object *obedit)
glShadeModel(GL_SMOOTH);
for (nu=cu->editnurb->nurbs.first; nu; nu=nu->next) {
if (!(nu->flag2&CU_SELECTED2)) continue;
- resoltrim = nu->resol_trim;
for (nt=nu->trims.first; nt; nt=nt->next) {
glBegin(GL_LINE_STRIP);
UI_ThemeColor(TH_WIRE);
@@ -1118,7 +1117,6 @@ static void draw_nurbuv(const struct bContext *C, ARegion *ar, Object *obedit)
/******* (Normalized Coordinates) draw trim curves *********/
for (nu=cu->editnurb->nurbs.first; nu; nu=nu->next) {
if (!(nu->flag2&CU_SELECTED2)) continue;
- resoltrim = nu->resol_trim;
for (nt=nu->trims.first; nt; nt=nt->next) {
glBegin(GL_LINE_STRIP);
UI_ThemeColor(TH_WIRE);
@@ -1133,7 +1131,7 @@ static void draw_nurbuv(const struct bContext *C, ARegion *ar, Object *obedit)
UI_ThemeColor((nt->flag&SELECT)? TH_NURB_SEL_TRIM_ADD : TH_NURB_TRIM_ADD);
break;
}
- j = BKE_nurbTrim_tess(nt, resoltrim, &trim_uv_pnts);
+ j = BKE_nurbTrim_tess(nt, &trim_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list