Skip to content

Commit

Permalink
some disorder to chaos added. renaming/indexing to mask node
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitron committed Jun 12, 2014
1 parent 98ae98a commit 09dfec8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
4 changes: 2 additions & 2 deletions node_Interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def eval_spline(splines,tknots,t_in):
return out

class SvInterpolationNode(Node, SverchCustomTreeNode):
'''Interpolate'''
'''Vector Interpolate'''
bl_idname = 'SvInterpolationNode'
bl_label = 'Interpolation'
bl_label = 'Vector Interpolation'
bl_icon = 'OUTLINER_OB_EMPTY'

t_in = FloatProperty(name="t", min=0, max=1, precision=5, default=.5, update=updateNode)
Expand Down
29 changes: 23 additions & 6 deletions node_MaskList.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def init(self, context):
self.inputs.new('StringsSocket', "mask", "mask")

self.outputs.new('StringsSocket', "mask", "mask")
self.outputs.new('StringsSocket', "ind_true", "ind_true")
self.outputs.new('StringsSocket', "ind_false", "ind_false")
self.outputs.new('StringsSocket', 'dataTrue', 'dataTrue')
self.outputs.new('StringsSocket', 'dataFalse', 'dataFalse')

Expand Down Expand Up @@ -54,20 +56,28 @@ def update(self):
result = self.getMask(data, mask, self.Level)

# outupy sockets data
if 'dataTrue' in self.outputs and self.outputs['dataTrue'].links:
if 'dataTrue' in self.outputs and self.outputs['dataTrue'].is_linked:
SvSetSocketAnyType(self,'dataTrue',result[0])
else:
SvSetSocketAnyType(self,'dataTrue',[[]])
# print ('всё',result)
if 'dataFalse' in self.outputs and self.outputs['dataFalse'].links:
if 'dataFalse' in self.outputs and self.outputs['dataFalse'].is_linked:
SvSetSocketAnyType(self,'dataFalse',result[1])
else:
SvSetSocketAnyType(self,'dataFalse',[[]])

if 'mask' in self.outputs and self.outputs['mask'].links:
if 'mask' in self.outputs and self.outputs['mask'].is_linked:
SvSetSocketAnyType(self,'mask',result[2])
else:
SvSetSocketAnyType(self,'mask',[[]])
SvSetSocketAnyType(self,'mask',[[]])
if 'ind_true' in self.outputs and self.outputs['ind_true'].is_linked:
SvSetSocketAnyType(self,'ind_true',result[3])
else:
SvSetSocketAnyType(self,'ind_true',[[]])
if 'ind_false' in self.outputs and self.outputs['ind_false'].is_linked:
SvSetSocketAnyType(self,'ind_false',result[4])
else:
SvSetSocketAnyType(self,'ind_false',[[]])



Expand All @@ -84,34 +94,41 @@ def putCurrentLevelList(self, list_a, list_b, mask_l, level, idx=0):
result_t = []
result_f = []
mask_out =[]
ind_true = []
ind_false = []
if level>1:
if type(list_a) in [list, tuple]:
for idx,l in enumerate(list_a):
l2 = self.putCurrentLevelList(l, list_b, mask_l, level-1, idx)
result_t.append(l2[0])
result_f.append(l2[1])
mask_out.append(l2[2])
ind_true.append(l2[3])
ind_false.append(l2[4])
else:
print('AHTUNG!!!')
return list_a
else:
indx = min(len(mask_l)-1, idx)
mask = mask_l[indx]
mask_0 = copy(mask)

while len(mask)<len(list_a):
if len(mask_0)==0:
mask_0 = [1,0]
mask = mask+mask_0

for idx,l in enumerate(list_a):
tmp = list_b.pop(0)
if mask[idx]:
result_t.append(tmp)
ind_true.append(idx)
else:
result_f.append(tmp)
ind_false.append(idx)
mask_out=mask[:len(list_a)]

return (result_t,result_f,mask_out)
return (result_t,result_f,mask_out, ind_true, ind_false)


def getCurrentLevelList(self, list_a, level):
Expand Down
4 changes: 2 additions & 2 deletions node_Noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def avail_noise(self,context):
return n_t

class SvNoiseNode(Node, SverchCustomTreeNode):
'''Basic Noise node'''
'''Vector Noise node'''
bl_idname = 'SvNoiseNode'
bl_label = 'Noise'
bl_label = 'Vector Noise'
bl_icon = 'OUTLINER_OB_EMPTY'

def changeMode(self,context):
Expand Down
1 change: 0 additions & 1 deletion node_Objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def draw_buttons(self, context, layout):
layout.prop(self, 'groupname', text='Group')
handle = handle_read(self.name+self.id_data.name)
if self.objects_local:
print(self.objects_local)
if handle[0]:
for o in handle[1]:
layout.label(o)
Expand Down
4 changes: 2 additions & 2 deletions node_VertSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def distK(v1,v2):
return sum((i[0]-i[1])**2 for i in zip(v1,v2))

class SvVertSortNode(Node, SverchCustomTreeNode):
'''Vertices sort'''
'''Vector sort'''
bl_idname = 'SvVertSortNode'
bl_label = 'Vertices Sort'
bl_label = 'Vector Sort'
bl_icon = 'OUTLINER_OB_EMPTY'

def mode_change(self,context):
Expand Down
12 changes: 6 additions & 6 deletions node_s.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def make_categories():
NodeItem("ListRepeaterNode", label="List Repeater"),
NodeItem("ListFuncNode", label="List Math"),
NodeItem("ListFlipNode", label="List Flip"),
NodeItem("MaskListNode", label="List Mask"),
NodeItem("SvMaskJoinNode", label="List Mask Join"),
NodeItem("MaskListNode", label="List Mask (out)"),
NodeItem("SvMaskJoinNode", label="List Mask Join (in)"),
NodeItem("ListSortNode", label="List Sort"),
NodeItem("ListShuffleNode", label="List Shuffle"),
NodeItem("ListMatchNode", label="List Match"),
Expand Down Expand Up @@ -263,10 +263,10 @@ def make_categories():
NodeItem("VectorMathNode", label="Vector Math"),
NodeItem("VectorDropNode", label="Vector Drop"),
NodeItem("VertsDelDoublesNode", label="Vector X Doubles"),
NodeItem("EvaluateLineNode", label="Vectors Evaluate"),
NodeItem("SvInterpolationNode", label="Interpolation"),
NodeItem("SvVertSortNode", label="Vertices Sort"),
NodeItem("SvNoiseNode", label="Noise"),
NodeItem("EvaluateLineNode", label="Vector Evaluate"),
NodeItem("SvInterpolationNode", label="Vector Interpolation"),
NodeItem("SvVertSortNode", label="Vector Sort"),
NodeItem("SvNoiseNode", label="Vector Noise"),
# ]),
#SverchNodeCategory("SVERCHOK_Ma", "SVERCHOK matrix", items=[
# # Matrix nodes
Expand Down

2 comments on commit 09dfec8

@ly29
Copy link
Collaborator

@ly29 ly29 commented on 09dfec8 Jun 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not happy about the menu layout either, many nodes have quite confusing names. Vector, points and vertices are not the same thing, I not sure they should be treated as such for example.
Or that everything in the List Menu needs to be List , it is the List menu after all... And so on.

@nortikin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to explain, why "List" "Vertex" "Matrix" added. To see directly without looking on top. tha same way icons coded by colors, so user can see intuitively what he has in menu, he not read List, he reads that after "List". My proposal - to make openGL menu, with icons. i have examples for this feature, and it was in plans. than we will not need namind List... but not see anything bad in list prefix.

About Vertices, vectors, points - you right. what you propose, vector, vertex or point? I propose stop on Vertex.

Please sign in to comment.