diff --git a/release/scripts/flt_toolbar.py b/release/scripts/flt_toolbar.py index 249c3f83dfc..565849859c1 100644 --- a/release/scripts/flt_toolbar.py +++ b/release/scripts/flt_toolbar.py @@ -134,8 +134,8 @@ def RGBtoHSV( r, g, b): 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 @@ def update_all(): 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 @@ def dfromact(): if not dof: dof = object else: - return + break + + if not dof: + return if 'FLT' not in dof.properties: dof.properties['FLT'] = dict() diff --git a/release/scripts/wizard_curve2tree.py b/release/scripts/wizard_curve2tree.py index 4ff8f6a8c1e..2dcda953a89 100644 --- a/release/scripts/wizard_curve2tree.py +++ b/release/scripts/wizard_curve2tree.py @@ -369,7 +369,12 @@ class tree: 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 @@ class branch: 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 @@ EVENT_REDRAW = 3 # 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 @@ def do_tree_generate(e,v): 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 @@ def gui(): 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 @@ def gui(): 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