Changeset 387:bc85c608b7b5


Ignore:
Timestamp:
04/28/10 13:36:43 (3 years ago)
Author:
ddangelo
Branch:
default
Convert:
svn:76c98907-0e80-4c83-94c7-b346fc2aefc2/trunk@393
Message:

Minor changes. LoadFile? scale node now stores its bounding box. Output format of the field_dump function changed.

Location:
avango-utils/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • avango-utils/python/_field_dump.py

    r374 r387  
    99     
    1010    for i in xrange(num_fields): 
    11         field = script.get_field(i) 
    12         name = script.get_field_name(i) 
    13         buffer += " " + str(name) +" <"+ str(field.value) +">\n"  
     11        field = script._get_field(i) 
     12        field_name = field._get_name() 
     13        field_type = field._get_type() 
     14        buffer += "Field: <"+ str(field_name) + "> of type: <" + str(field_type) + "> = <" + str(field.value) + ">\n"  
    1415         
    1516    return buffer 
  • avango-utils/python/_loadfile_scaler.py

    r373 r387  
    88    LoadFileFinished = avango.SFString() 
    99    Radius = avango.SFFloat() 
     10     
    1011    MatrixOut = avango.osg.SFMatrix() 
     12    Trigger = avango.SFBool() 
    1113     
    1214    def __init__(self): 
    1315        self.super(LoadFileScaler).__init__() 
    1416         
     17        self.bounding_box = None 
    1518        self.Radius.value = 1.0 
    1619        self.__file_loaded = False 
     
    2528        if self.__file_loaded: 
    2629            self.MatrixOut.value = self.calc_scale_matrix() 
     30            self.Trigger.value = True 
    2731            self.__file_loaded = False 
    2832 
    2933    def calc_scale_matrix(self): 
    30         b = avango.osg.calc_bounding_box(self.LoadFile.value) 
    31         width = b.x_max() - b.x_min() 
    32         height = b.y_max() - b.y_min() 
    33         depth = b.z_max() - b.z_min() 
     34        self.bounding_box = avango.osg.calc_bounding_box(self.LoadFile.value) 
     35        width =  self.bounding_box.x_max() - self.bounding_box.x_min() 
     36        height = self.bounding_box.y_max() - self.bounding_box.y_min() 
     37        depth =  self.bounding_box.z_max() - self.bounding_box.z_min() 
    3438        max_extend = max(max(width,height),depth) 
    3539        scaleFactor = 2.0 / (max_extend); 
Note: See TracChangeset for help on using the changeset viewer.