(self, name, data=None)
Load data for an attribute variable.
Load data for an attribute variable.
Load data for an attribute variable .
def load_attribute(self, name, data=None):
        """Load data for an attribute variable."""
        variable = self.get_variable(name)
        if variable['sliced_attribute'].location < 0:
            log_debug(("Variable '%s' could not be loaded, probably because "
                      "it is not used in the shaders") % name)
            return
        olddata = variable.get('data', None)
        if isinstance(olddata, RefVar):
            log_debug("Skipping loading data for attribute '%s' since it "
                "references a target variable." % name)
            return
        if data is None:
            data = olddata
        if data is not None:
            # normalization
            # if name in self.options.get('normalizers', {}):
                # viewbox = self.options['normalizers'][name]
                # if viewbox:
                    # self.normalizers[name] = DataNormalizer(data)
                    # # normalize data with the specified viewbox, None by default
                    # # meaning that the natural bounds of the data are used.
                    # data = self.normalizers[name].normalize(viewbox)
            variable['sliced_attribute'].load(data)
def load_attribute ( self , name , data = None ) : variable = self . get_variable ( name ) if variable [ 'sliced_attribute' ] . location < 0 : log_debug ( ( "Variable '%s' could not be loaded, probably because " "it is not used in the shaders" ) % name ) return olddata = variable . get ( 'data' , None ) if isinstance ( olddata , RefVar ) : log_debug ( "Skipping loading data for attribute '%s' since it " "references a target variable." % name ) return if data is None : data = olddata if data is not None : # normalization # if name in self.options.get('normalizers', {}): # viewbox = self.options['normalizers'][name] # if viewbox: # self.normalizers[name] = DataNormalizer(data) # # normalize data with the specified viewbox, None by default # # meaning that the natural bounds of the data are used. # data = self.normalizers[name].normalize(viewbox) variable [ 'sliced_attribute' ] . load ( data )