[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14341] trunk/blender/release/scripts: added a help link to wiki docs for curve2tree, fixed some bugs in flt_toolbar

Campbell Barton ideasman42 at gmail.com
Sun Apr 6 19:11:14 CEST 2008


Revision: 14341
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14341
Author:   campbellbarton
Date:     2008-04-06 19:11:14 +0200 (Sun, 06 Apr 2008)

Log Message:
-----------
added a help link to wiki docs for curve2tree, fixed some bugs in flt_toolbar

Modified Paths:
--------------
    trunk/blender/release/scripts/flt_toolbar.py
    trunk/blender/release/scripts/wizard_curve2tree.py

Modified: trunk/blender/release/scripts/flt_toolbar.py
===================================================================
--- trunk/blender/release/scripts/flt_toolbar.py	2008-04-06 13:44:50 UTC (rev 14340)
+++ trunk/blender/release/scripts/flt_toolbar.py	2008-04-06 17:11:14 UTC (rev 14341)
@@ -134,8 +134,8 @@
 
 def update_state():
 	state = dict()
-	state["activeScene"] = Blender.Scene.getCurrent()
-	state["activeObject"] = state["activeScene"].getActiveObject()
+	state["activeScene"] = Blender.Scene.GetCurrent()
+	state["activeObject"] = state["activeScene"].objects.active
 	if state["activeObject"] and not state["activeObject"].sel:
 		state["activeObject"] = None
 	state["activeMesh"] = None
@@ -290,12 +290,12 @@
 		Blender.Window.EditMode(0)
 		editmode = 1
 	state = update_state()
-	
+	colors = None
 	if state["activeScene"].properties.has_key('FLT'):
 		try:
 			colors = state["activeScene"].properties['FLT']['Color Palette']
 		except:
-			colors = None
+			pass
 	if colors:
 		#update the baked FLT colors for all meshes.
 		for object in state["activeScene"].objects:
@@ -596,7 +596,10 @@
 			if not dof:
 				dof = object
 			else:
-				return 
+				break
+	
+	if not dof:
+		return
 	
 	if 'FLT' not in dof.properties:
 		dof.properties['FLT'] = dict()	

Modified: trunk/blender/release/scripts/wizard_curve2tree.py
===================================================================
--- trunk/blender/release/scripts/wizard_curve2tree.py	2008-04-06 13:44:50 UTC (rev 14340)
+++ trunk/blender/release/scripts/wizard_curve2tree.py	2008-04-06 17:11:14 UTC (rev 14341)
@@ -369,7 +369,12 @@
 						pt_best_j, dist = brch_j.findClosest(brch_i.bpoints[0].co)
 						
 						# Check its in range, allow for a bit out - hense the sloppy
-						if dist < pt_best_j.radius * sloppy:
+						# The second check in the following IF was added incase the point is close enough to the line but the midpoint is further away
+						# ...in this case the the resulting mesh will be adjusted to fit the join so its best to make it.
+						if 	(dist <											pt_best_j.radius * sloppy)  or \
+							((brch_i.bpoints[0].co - pt_best_j.co).length <	pt_best_j.radius * sloppy):
+							
+							
 							brch_i.parent_pt = pt_best_j
 							pt_best_j.childCount += 1 # dont remove me
 							
@@ -2676,6 +2681,7 @@
 				co_on_line, fac = ClosestPointOnLine(co, pt.co, pt.next.co)
 				print fac
 				if fac >= 0.0 and fac <= 1.0:
+					
 					return pt, (co-co_on_line).length
 		
 		return best, best_dist
@@ -3051,7 +3057,7 @@
 
 # Prefs for each tree
 PREFS = {}
-PREFS['connect_sloppy'] = Draw.Create(1.0)
+PREFS['connect_sloppy'] = Draw.Create(1.5)
 PREFS['connect_base_trim'] = Draw.Create(1.0)
 PREFS['seg_density'] = Draw.Create(0.5)
 PREFS['seg_density_angle'] = Draw.Create(20.0)
@@ -3630,8 +3636,18 @@
 		Blender.Draw.PupMenu('Error%t|Nurbs and Poly curve types cant be used!')
 		GLOBALS['non_bez_error'] = 0
 		
+def do_tree_help(e,v):
+	url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx'
+	print 'Trying to open web browser with documentation at this address...'
+	print '\t' + url
 	
-	
+	try:
+		import webbrowser
+		webbrowser.open(url)
+	except:
+		print '...could not open a browser window.'
+
+
 def evt(e,val):
 	pass
 
@@ -3967,7 +3983,7 @@
 	xtmp = x
 	# ---------- ---------- ---------- ----------
 	
-	PREFS['connect_sloppy'] =	Draw.Number('Connect Limit',EVENT_UPDATE, xtmp, y, but_width*2, but_height, PREFS['connect_sloppy'].val,	0.1, 2.0,	'Strictness when connecting branches'); xtmp += but_width*2;
+	PREFS['connect_sloppy'] =	Draw.Number('Connect Limit',EVENT_UPDATE, xtmp, y, but_width*2, but_height, PREFS['connect_sloppy'].val,	0.1, 3.0,	'Strictness when connecting branches'); xtmp += but_width*2;
 	PREFS['connect_base_trim'] =	Draw.Number('Joint Bevel',	EVENT_UPDATE, xtmp, y, but_width*2, but_height, PREFS['connect_base_trim'].val,	0.0, 2.0,	'low value for a tight join, hi for a smoother bevel'); xtmp += but_width*2;
 	Blender.Draw.EndAlign()
 	y-=but_height+MARGIN
@@ -4000,7 +4016,8 @@
 	
 	Blender.Draw.BeginAlign()
 	Draw.PushButton('Exit',	EVENT_EXIT, xtmp, y, but_width, but_height,	''); xtmp += but_width;
-	Draw.PushButton('Generate from selection',	EVENT_REDRAW, xtmp, y, but_width*3, but_height,	'Generate mesh', do_tree_generate); xtmp += but_width*3;
+	Draw.PushButton('Help',	EVENT_NONE, xtmp, y, but_width, but_height,	'', do_tree_help); xtmp += but_width;
+	Draw.PushButton('Generate from selection',	EVENT_REDRAW, xtmp, y, but_width*2, but_height,	'Generate mesh', do_tree_generate); xtmp += but_width*3;
 	Blender.Draw.EndAlign()
 	y-=but_height+MARGIN
 	xtmp = x





More information about the Bf-blender-cvs mailing list