[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23070] branches/blender2.5/blender: curve .textboxes collection access for the UI + minor UI tweaks for poly curves

Campbell Barton ideasman42 at gmail.com
Wed Sep 9 02:10:12 CEST 2009


Revision: 23070
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23070
Author:   campbellbarton
Date:     2009-09-09 02:10:12 +0200 (Wed, 09 Sep 2009)

Log Message:
-----------
curve.textboxes collection access for the UI + minor UI tweaks for poly curves

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_curve.py
    branches/blender2.5/blender/release/ui/buttons_data_text.py
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c

Modified: branches/blender2.5/blender/release/ui/buttons_data_curve.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_curve.py	2009-09-08 22:46:14 UTC (rev 23069)
+++ branches/blender2.5/blender/release/ui/buttons_data_curve.py	2009-09-09 00:10:12 UTC (rev 23070)
@@ -15,7 +15,7 @@
 	'''
 	def poll(self, context):
 		return (context.object and context.object.type == 'CURVE' and context.curve)
-		
+
 class DataButtonsPanelActive(DataButtonsPanel):
 	'''
 	Same as above but for curves only
@@ -80,7 +80,7 @@
 		sub = col.column(align=True)
 		sub.itemR(curve, "resolution_u", text="Preview U")
 		sub.itemR(curve, "render_resolution_u", text="Render U")
-		
+
 		if is_surf:
 			sub = col.column(align=True)
 			sub.itemR(curve, "resolution_v", text="Preview V")
@@ -150,59 +150,70 @@
 		curve = context.curve
 		act_spline = curve.active_spline
 		is_surf = (ob.type == 'SURFACE')
+		is_poly = (act_spline.type == 'POLY')
 		
 		split = layout.split()
 		
-		col = split.column()
-		col.itemL(text="Cyclic:")
-		if act_spline.type == 'NURBS':
-			col.itemL(text="Bezier:")
-			col.itemL(text="Endpoint:")
-			col.itemL(text="Order:")
-		col.itemL(text="Resolution:")
+		if is_poly:
+			# These settings are below but its easier to have 
+			# poly's set aside since they use so few settings
+			col = split.column()
+			col.itemL(text="Cyclic:")
+			col.itemR(act_spline, "smooth")
+			col = split.column()
+			col.itemR(act_spline, "cyclic_u", text="U")
 		
-		col = split.column()
-		col.itemR(act_spline, "cyclic_u", text="U")
-		
-		if act_spline.type == 'NURBS':
-			sub = col.column()
-			sub.active = (not act_spline.cyclic_u)
-			sub.itemR(act_spline, "bezier_u", text="U")
-			sub.itemR(act_spline, "endpoint_u", text="U")
+		else:
+			col = split.column()
+			col.itemL(text="Cyclic:")
+			if act_spline.type == 'NURBS':
+				col.itemL(text="Bezier:")
+				col.itemL(text="Endpoint:")
+				col.itemL(text="Order:")
 			
-			sub = col.column()
-			sub.itemR(act_spline, "order_u", text="U")
-		col.itemR(act_spline, "resolution_u", text="U")
-		
-		if is_surf:
+			col.itemL(text="Resolution:")
+					
 			col = split.column()
-			col.itemR(act_spline, "cyclic_v", text="V")
+			col.itemR(act_spline, "cyclic_u", text="U")
 			
-			# its a surface, assume its a nurb.
-			sub = col.column()
-			sub.active = (not act_spline.cyclic_v)
-			sub.itemR(act_spline, "bezier_v", text="V")
-			sub.itemR(act_spline, "endpoint_v", text="V")
-			sub = col.column()
-			sub.itemR(act_spline, "order_v", text="V")
-			sub.itemR(act_spline, "resolution_v", text="V")
+			if act_spline.type == 'NURBS':
+				sub = col.column()
+				# sub.active = (not act_spline.cyclic_u)
+				sub.itemR(act_spline, "bezier_u", text="U")
+				sub.itemR(act_spline, "endpoint_u", text="U")
+				
+				sub = col.column()
+				sub.itemR(act_spline, "order_u", text="U")
+			col.itemR(act_spline, "resolution_u", text="U")
+			
+			if is_surf:
+				col = split.column()
+				col.itemR(act_spline, "cyclic_v", text="V")
+				
+				# its a surface, assume its a nurb.
+				sub = col.column()
+				sub.active = (not act_spline.cyclic_v)
+				sub.itemR(act_spline, "bezier_v", text="V")
+				sub.itemR(act_spline, "endpoint_v", text="V")
+				sub = col.column()
+				sub.itemR(act_spline, "order_v", text="V")
+				sub.itemR(act_spline, "resolution_v", text="V")
 
-		
-		if not is_surf:
+			
+			if not is_surf:
+				split = layout.split()
+				col = split.column()
+				col.active = (not curve.curve_2d)
+				
+				col.itemL(text="Interpolation:")
+				col.itemR(act_spline, "tilt_interpolation", text="Tilt")
+				col.itemR(act_spline, "radius_interpolation", text="Radius")
+			
 			split = layout.split()
 			col = split.column()
-			col.active = (not curve.curve_2d)
-			
-			col.itemL(text="Interpolation:")
-			col.itemR(act_spline, "tilt_interpolation", text="Tilt")
-			col.itemR(act_spline, "radius_interpolation", text="Radius")
-		
-		
-		split = layout.split()
-		col = split.column()
-		col.itemR(act_spline, "smooth")
-		
-		
+			col.itemR(act_spline, "smooth")
+
+
 bpy.types.register(DATA_PT_context_curve)
 bpy.types.register(DATA_PT_shape_curve)
 bpy.types.register(DATA_PT_geometry_curve)

Modified: branches/blender2.5/blender/release/ui/buttons_data_text.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_text.py	2009-09-08 22:46:14 UTC (rev 23069)
+++ branches/blender2.5/blender/release/ui/buttons_data_text.py	2009-09-09 00:10:12 UTC (rev 23070)
@@ -44,8 +44,10 @@
 		
 		col = split.column()
 		col.itemL(text="Caps:")
-		col.itemR(curve, "front")
-		col.itemR(curve, "back")
+		row = col.row()
+		row .itemR(curve, "front")
+		row .itemR(curve, "back")
+		# col = split.column()
 		col.itemL(text="Textures:")
 		col.itemR(curve, "uv_orco")
 		col.itemR(curve, "auto_texspace")
@@ -55,11 +57,12 @@
 		sub = col.column(align=True)
 		sub.itemR(curve, "resolution_u", text="Preview U")
 		sub.itemR(curve, "render_resolution_u", text="Render U")
+		
+		# resolution_v is not used for text
+		
 		sub = col.column(align=True)
-		sub.itemR(curve, "resolution_v", text="Preview V")
-		sub.itemR(curve, "render_resolution_v", text="Render V")
 		col.itemL(text="Display:")
-		col.itemR(curve, "fast")
+		col.itemR(curve, "fast", text="Fast Editing")
 
 class DATA_PT_geometry_text(DataButtonsPanel):
 	__label__ = "Geometry"
@@ -93,19 +96,19 @@
 		
 		text = context.curve
 		char = context.curve.edit_format
-		
+
 		layout.itemR(text, "font")
 		
 		row = layout.row()
 		row.itemR(text, "text_size", text="Size")	
 		row.itemR(text, "shear")
-			
+		
 		split = layout.split()
 		
-		col = split.column()
+		col = split.column()	
 		col.itemL(text="Object Font:")
 		col.itemR(text, "family", text="")
-		
+
 		col = split.column()
 		col.itemL(text="Text on Curve:")
 		col.itemR(text, "text_on_curve", text="")
@@ -158,19 +161,19 @@
 		layout = self.layout
 			
 		text = context.curve
-		box = context.curve.textbox
 		
-		split = layout.box().split()
+		for box in text.textboxes:
+			split = layout.box().split()
+			
+			col = split.column(align=True)
+			col.itemL(text="Dimensions:")
+			col.itemR(box, "width", text="Width")
+			col.itemR(box, "height", text="Height")
 		
-		col = split.column(align=True)
-		col.itemL(text="Dimensions:")
-		col.itemR(box, "width", text="Width")
-		col.itemR(box, "height", text="Height")
-		
-		col = split.column(align=True)	
-		col.itemL(text="Offset:")
-		col.itemR(box, "x", text="X")
-		col.itemR(box, "y", text="Y")
+			col = split.column(align=True)	
+			col.itemL(text="Offset:")
+			col.itemR(box, "x", text="X")
+			col.itemR(box, "y", text="Y")
 
 bpy.types.register(DATA_PT_context_text)	
 bpy.types.register(DATA_PT_shape_text)	

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c	2009-09-08 22:46:14 UTC (rev 23069)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c	2009-09-09 00:10:12 UTC (rev 23070)
@@ -159,6 +159,14 @@
 	*max= cu->totcol-1;
 }
 
+static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max)
+{
+	Curve *cu= (Curve*)ptr->id.data;
+	*min= 0;
+	*max= cu->totbox-1;
+}
+
+
 static void rna_Curve_2d_set(PointerRNA *ptr, int value)
 {
 	Curve *cu= (Curve*)ptr->id.data;
@@ -509,11 +517,15 @@
 	RNA_def_property_ui_text(prop, "Underline Thickness", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
+	prop= RNA_def_property(srna, "textboxes", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox");
+	RNA_def_property_struct_type(prop, "TextBox");
+	RNA_def_property_ui_text(prop, "Textboxes", "");
+
 	prop= RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "actbox");
-	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "The active text box", "");
-	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range");
 	
 	/* strings */
 	prop= RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
@@ -539,12 +551,7 @@
 	RNA_def_property_pointer_sdna(prop, NULL, "vfont");
 	RNA_def_property_ui_text(prop, "Font", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-	
-	prop= RNA_def_property(srna, "textbox", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "tb");
-	RNA_def_property_ui_text(prop, "Textbox", "");
-	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-	
+
 	prop= RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
 	RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting.");





More information about the Bf-blender-cvs mailing list