def process(self): if not any(socket.is_linked for socket in self.outputs): return center_s = self.inputs['Center'].sv_get() amplitudes_s = self.inputs['Amplitude'].sv_get(default=[0.5]) coefficients_s = self.inputs['Coefficient'].sv_get(default=[0.5]) fields_out = [] for centers, amplitudes, coefficients in zip_long_repeat( center_s, amplitudes_s, coefficients_s): for center, amplitude, coefficient in zip_long_repeat( centers, amplitudes, coefficients): if self.falloff_type == 'NONE': falloff_func = None else: falloff_func = falloff_array(self.falloff_type, amplitude, coefficient, self.clamp) field = SvScalarFieldPointDistance(np.array(center), metric=self.metric, power=self.power, falloff=falloff_func) fields_out.append(field) self.outputs['Field'].sv_set(fields_out)
def process(self): if not any(socket.is_linked for socket in self.outputs): return center_s = self.inputs['Center'].sv_get() directions_s = self.inputs['Direction'].sv_get() amplitudes_s = self.inputs['Amplitude'].sv_get() coefficients_s = self.inputs['Coefficient'].sv_get() vfields_out = [] objects = zip_long_repeat(center_s, directions_s, amplitudes_s, coefficients_s) for centers, direction, amplitude, coefficient in objects: if isinstance(amplitude, (list, tuple)): amplitude = amplitude[0] if isinstance(coefficient, (list, tuple)): coefficient = coefficient[0] if self.falloff_type == 'NONE': falloff_func = None else: falloff_func = falloff_array(self.falloff_type, amplitude, coefficient, self.clamp) vfields_out.append( self.rotation_fields(centers, direction, falloff_func)) self.outputs['VField'].sv_set(vfields_out)
def process(self): if not any(socket.is_linked for socket in self.outputs): return center_s = self.inputs['Center'].sv_get() edges_s = self.inputs['Edges'].sv_get(default=[[]]) faces_s = self.inputs['Faces'].sv_get(default=[[]]) directions_s = self.inputs['Direction'].sv_get() radius_s = self.inputs['Radius'].sv_get() amplitudes_s = self.inputs['Amplitude'].sv_get() coefficients_s = self.inputs['Coefficient'].sv_get() vfields_out = [] sfields_out = [] objects = zip_long_repeat(center_s, edges_s, faces_s, directions_s, radius_s, amplitudes_s, coefficients_s) for centers, edges, faces, direction, radius, amplitude, coefficient in objects: if isinstance(amplitude, (list, tuple)): amplitude = amplitude[0] if isinstance(coefficient, (list, tuple)): coefficient = coefficient[0] if not isinstance(radius, (list, tuple)): radius = [radius] if self.falloff_type == 'NONE': falloff_func = None else: falloff_func = falloff_array(self.falloff_type, amplitude, coefficient, self.clamp) if self.attractor_type == 'Point': vfield, sfield = self.to_point(centers, falloff_func) elif self.attractor_type == 'Line': vfield, sfield = self.to_line(centers, direction, falloff_func) elif self.attractor_type == 'Plane': vfield, sfield = self.to_plane(centers, direction, falloff_func) elif self.attractor_type == 'Mesh': vfield, sfield = self.to_mesh(centers, faces, falloff_func) elif self.attractor_type == 'Edge': vfield, sfield = self.to_edges(centers, edges, falloff_func) elif self.attractor_type == 'Circle': vfield, sfield = self.to_circle(centers, direction, radius, falloff_func) else: raise Exception("not implemented yet") vfields_out.append(vfield) sfields_out.append(sfield) self.outputs['SField'].sv_set(sfields_out) self.outputs['VField'].sv_set(vfields_out)