forked from bartvdbraak/blender
added a help link to wiki docs for curve2tree, fixed some bugs in flt_toolbar
This commit is contained in:
parent
6c3bd2a02d
commit
711306c2ba
@ -134,8 +134,8 @@ def RGBtoHSV( r, g, b):
|
|||||||
|
|
||||||
def update_state():
|
def update_state():
|
||||||
state = dict()
|
state = dict()
|
||||||
state["activeScene"] = Blender.Scene.getCurrent()
|
state["activeScene"] = Blender.Scene.GetCurrent()
|
||||||
state["activeObject"] = state["activeScene"].getActiveObject()
|
state["activeObject"] = state["activeScene"].objects.active
|
||||||
if state["activeObject"] and not state["activeObject"].sel:
|
if state["activeObject"] and not state["activeObject"].sel:
|
||||||
state["activeObject"] = None
|
state["activeObject"] = None
|
||||||
state["activeMesh"] = None
|
state["activeMesh"] = None
|
||||||
@ -290,12 +290,12 @@ def update_all():
|
|||||||
Blender.Window.EditMode(0)
|
Blender.Window.EditMode(0)
|
||||||
editmode = 1
|
editmode = 1
|
||||||
state = update_state()
|
state = update_state()
|
||||||
|
colors = None
|
||||||
if state["activeScene"].properties.has_key('FLT'):
|
if state["activeScene"].properties.has_key('FLT'):
|
||||||
try:
|
try:
|
||||||
colors = state["activeScene"].properties['FLT']['Color Palette']
|
colors = state["activeScene"].properties['FLT']['Color Palette']
|
||||||
except:
|
except:
|
||||||
colors = None
|
pass
|
||||||
if colors:
|
if colors:
|
||||||
#update the baked FLT colors for all meshes.
|
#update the baked FLT colors for all meshes.
|
||||||
for object in state["activeScene"].objects:
|
for object in state["activeScene"].objects:
|
||||||
@ -596,7 +596,10 @@ def dfromact():
|
|||||||
if not dof:
|
if not dof:
|
||||||
dof = object
|
dof = object
|
||||||
else:
|
else:
|
||||||
return
|
break
|
||||||
|
|
||||||
|
if not dof:
|
||||||
|
return
|
||||||
|
|
||||||
if 'FLT' not in dof.properties:
|
if 'FLT' not in dof.properties:
|
||||||
dof.properties['FLT'] = dict()
|
dof.properties['FLT'] = dict()
|
||||||
|
@ -369,7 +369,12 @@ class tree:
|
|||||||
pt_best_j, dist = brch_j.findClosest(brch_i.bpoints[0].co)
|
pt_best_j, dist = brch_j.findClosest(brch_i.bpoints[0].co)
|
||||||
|
|
||||||
# Check its in range, allow for a bit out - hense the sloppy
|
# 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
|
brch_i.parent_pt = pt_best_j
|
||||||
pt_best_j.childCount += 1 # dont remove me
|
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)
|
co_on_line, fac = ClosestPointOnLine(co, pt.co, pt.next.co)
|
||||||
print fac
|
print fac
|
||||||
if fac >= 0.0 and fac <= 1.0:
|
if fac >= 0.0 and fac <= 1.0:
|
||||||
|
|
||||||
return pt, (co-co_on_line).length
|
return pt, (co-co_on_line).length
|
||||||
|
|
||||||
return best, best_dist
|
return best, best_dist
|
||||||
@ -3051,7 +3057,7 @@ EVENT_REDRAW = 3
|
|||||||
|
|
||||||
# Prefs for each tree
|
# Prefs for each tree
|
||||||
PREFS = {}
|
PREFS = {}
|
||||||
PREFS['connect_sloppy'] = Draw.Create(1.0)
|
PREFS['connect_sloppy'] = Draw.Create(1.5)
|
||||||
PREFS['connect_base_trim'] = Draw.Create(1.0)
|
PREFS['connect_base_trim'] = Draw.Create(1.0)
|
||||||
PREFS['seg_density'] = Draw.Create(0.5)
|
PREFS['seg_density'] = Draw.Create(0.5)
|
||||||
PREFS['seg_density_angle'] = Draw.Create(20.0)
|
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!')
|
Blender.Draw.PupMenu('Error%t|Nurbs and Poly curve types cant be used!')
|
||||||
GLOBALS['non_bez_error'] = 0
|
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):
|
def evt(e,val):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -3967,7 +3983,7 @@ def gui():
|
|||||||
xtmp = x
|
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;
|
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()
|
Blender.Draw.EndAlign()
|
||||||
y-=but_height+MARGIN
|
y-=but_height+MARGIN
|
||||||
@ -4000,7 +4016,8 @@ def gui():
|
|||||||
|
|
||||||
Blender.Draw.BeginAlign()
|
Blender.Draw.BeginAlign()
|
||||||
Draw.PushButton('Exit', EVENT_EXIT, xtmp, y, but_width, but_height, ''); xtmp += but_width;
|
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()
|
Blender.Draw.EndAlign()
|
||||||
y-=but_height+MARGIN
|
y-=but_height+MARGIN
|
||||||
xtmp = x
|
xtmp = x
|
||||||
|
Loading…
Reference in New Issue
Block a user