def add_control_and_colors(snames, layername): """ helper that adds a layer for the visibility setting (on/off) and sublayer for the visible fields of an object. """ for s in snames: #a sublayer for the visibility of each object vparam = cinema_store.make_parameter(layername + s, ["ON", "OFF"]) cs.add_sublayer(layername + s, vparam, layername, s) #make up list of color options fields = {'depth': 'depth', 'luminance': 'luminance'} ranges = {} sp = paraview.simple.FindSource(s) defaultName = None cda = sp.GetCellDataInformation() for a in range(0, cda.GetNumberOfArrays()): arr = cda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName + "_" + str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName pda = sp.GetPointDataInformation() for a in range(0, pda.GetNumberOfArrays()): arr = pda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName + "_" + str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName if defaultName == None: fields['white'] = 'rgb' defaultName = 'white' cparam = cinema_store.make_field("color" + s, fields, default=defaultName, valueRanges=ranges) cs.add_field("color" + s, cparam, layername + s, "ON") #remember my parameter name for my dependees objhomes[asdict[s]['id']] = layername + s
def add_control_and_colors(snames, layername): """ helper that adds a layer for the visibility setting (on/off) and sublayer for the visible fields of an object. """ for s in snames: #a sublayer for the visibility of each object vparam = cinema_store.make_parameter(layername+s, ["ON","OFF"]) cs.add_sublayer(layername+s, vparam, layername, s) #make up list of color options fields = {'depth':'depth','luminance':'luminance'} ranges = {} sp = paraview.simple.FindSource(s) defaultName = None cda = sp.GetCellDataInformation() for a in range(0, cda.GetNumberOfArrays()): arr = cda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName+"_"+str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName pda = sp.GetPointDataInformation() for a in range(0, pda.GetNumberOfArrays()): arr = pda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName+"_"+str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName if defaultName == None: fields['white']='rgb' defaultName='white' cparam = cinema_store.make_field("color"+s, fields, default=defaultName, valueRanges=ranges) cs.add_field("color"+s,cparam,layername+s,"ON") #remember my parameter name for my dependees objhomes[asdict[s]['id']] = layername+s
def add_control_and_colors(name, cs, userDefined, arrayRanges): """add parameters that change the settings and color of a filter""" source = paraview.simple.FindSource(name) # make up list of color options fields = {"depth": "depth", "luminance": "luminance"} defaultName = None view_proxy = paraview.simple.GetActiveView() rep = paraview.servermanager.GetRepresentation(source, view_proxy) # select value arrays if rep.Representation != "Outline": defaultName = add_customized_array_selection(name, source, fields, userDefined, arrayRanges) if defaultName == None: fields["white"] = "rgb" defaultName = "white" cparam = cinema_store.make_field("color" + name, fields, default=defaultName, valueRanges=arrayRanges) cs.add_field("color" + name, cparam, "vis", [name])
def add_control_and_colors(name, cs, userDefined): """add parameters that change the settings and color of a filter""" source = paraview.simple.FindSource(name) #make up list of color options fields = {'depth':'depth','luminance':'luminance'} ranges = {} defaultName = None view_proxy = paraview.simple.GetActiveView() rep = paraview.servermanager.GetRepresentation(source, view_proxy) # select value arrays if rep.Representation != 'Outline': defaultName = add_customized_array_selection(name, source, fields, ranges, userDefined) if defaultName == None: fields['white']='rgb' defaultName='white' cparam = cinema_store.make_field("color"+name, fields, default=defaultName, valueRanges=ranges) cs.add_field("color"+name,cparam,'vis',[name])
def add_control_and_colors(name, cs, userDefined): """add parameters that change the settings and color of a filter""" source = paraview.simple.FindSource(name) #make up list of color options fields = {'depth':'depth','luminance':'luminance'} ranges = {} defaultName = None view_proxy = paraview.simple.GetActiveView() rep = paraview.simple.GetRepresentation(source, view_proxy) # select value arrays if rep.Representation != 'Outline': defaultName = add_customized_array_selection(name, source, fields, ranges, userDefined) if defaultName == None: fields['white']='rgb' defaultName='white' cparam = cinema_store.make_field("color"+name, fields, default=defaultName, valueRanges=ranges) cs.add_field("color"+name,cparam,'vis',[name])
def add_control_and_colors(name, cs): source = paraview.simple.FindSource(name) #make up list of color options fields = {'depth':'depth','luminance':'luminance'} ranges = {} defaultName = None view_proxy = paraview.simple.GetActiveView() rep = paraview.simple.GetRepresentation(source, view_proxy) if rep.Representation != 'Outline': cda = source.GetCellDataInformation() for a in range(0, cda.GetNumberOfArrays()): arr = cda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName+"_"+str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName pda = source.GetPointDataInformation() for a in range(0, pda.GetNumberOfArrays()): arr = pda.GetArray(a) arrName = arr.GetName() if not arrName == "Normals": for i in range(0, arr.GetNumberOfComponents()): fName = arrName+"_"+str(i) fields[fName] = 'value' ranges[fName] = arr.GetRange(i) if defaultName == None: defaultName = fName if defaultName == None: fields['white']='rgb' defaultName='white' cparam = cinema_store.make_field("color"+name, fields, default=defaultName, valueRanges=ranges) cs.add_field("color"+name,cparam,'vis',[name])