def create_cow_changed(self):
        if self.CreateCow.value:
            transform_name = "transformObject"+str(self.actual_object_num)
            wobble_name = "wobbleObject"+str(self.actual_object_num)
            drag_name = "dragObject"+str(self.actual_object_num)


            state_set = avango.osg.nodes.StateSet()
            state_set.RescaleNormalMode.value = 1

            transform_object = avango.osg.nodes.LoadFile(Name=transform_name,Filename="/home/ddangelo/data/osgData/cow.osg", StateSet=state_set)
            drag_object = avango.osg.nodes.MatrixTransform(Name=drag_name)
            inspector_object = avango.osg.nodes.MatrixTransform(Name=wobble_name)

            drag_object.Children.value.append(inspector_object)
            inspector_object.Children.value.append(transform_object)


            transform_object.add_and_init_field(avango.script.SFObject(), "MenuToolBehavior", object_behavior)

            object_root.Children.value.append(drag_object)

            self.actual_object_num += 1

            inspector.update_model()

        # wait for button release to close menu - otherwise the widget will miss the button release,
        # because the widget is removed from panel before the button was released.
        if self.old_cow_state and not self.CreateCow.value:
            panel_group.hide_panels()

        self.old_cow_state = self.CreateCow.value
    def delete_object_changed(self):
        print "A Delete object"
        # react on butten release: close panel and delete object
        if self.delete_old_state and not self.DeleteObject.value:
            scene_graph_parent = self.hit_object.Parents.value[0].Parents.value[0]
            print "hitObjectName: " + str(scene_graph_parent.Name.value)
            #scene_root.Children.value.remove(self.hit_object)
            object_root.Children.value.remove(scene_graph_parent)
            self.delete_old_state = False
            panel_group.hide_panels()

            print "B Delete object"

            inspector.update_model()

            #self.actual_object_num -= 1

        self.delete_old_state = self.DeleteObject.value
    def create_sphere_changed(self):
        if self.CreateSphere.value:

            new_sphere = avango.osg.nodes.Sphere(Radius=1.0,
                                                 Name="dragObject"+str(self.actual_object_num))
            new_sphere.add_and_init_field(avango.script.SFObject(), "MenuToolBehavior", object_behavior)

            object_root.Children.value.append(new_sphere)

            self.actual_object_num += 1

            inspector.update_model()

        # wait for button release to close menu - otherwise the widget will miss the button release,
        # because the widget is removed from panel before the button was released.
        if self.old_sphere_state and not self.CreateSphere.value:
            panel_group.hide_panels()

        self.old_sphere_state = self.CreateSphere.value
Beispiel #4
0
    def delete_object_changed(self):
        print "A Delete object"
        # react on butten release: close panel and delete object
        if self.delete_old_state and not self.DeleteObject.value:
            scene_graph_parent = self.hit_object.Parents.value[
                0].Parents.value[0]
            print "hitObjectName: " + str(scene_graph_parent.Name.value)
            #scene_root.Children.value.remove(self.hit_object)
            object_root.Children.value.remove(scene_graph_parent)
            self.delete_old_state = False
            panel_group.hide_panels()

            print "B Delete object"

            inspector.update_model()

            #self.actual_object_num -= 1

        self.delete_old_state = self.DeleteObject.value
Beispiel #5
0
    def create_sphere_changed(self):
        if self.CreateSphere.value:

            new_sphere = avango.osg.nodes.Sphere(Radius=1.0,
                                                 Name="dragObject" +
                                                 str(self.actual_object_num))
            new_sphere.add_and_init_field(avango.script.SFObject(),
                                          "MenuToolBehavior", object_behavior)

            object_root.Children.value.append(new_sphere)

            self.actual_object_num += 1

            inspector.update_model()

        # wait for button release to close menu - otherwise the widget will miss the button release,
        # because the widget is removed from panel before the button was released.
        if self.old_sphere_state and not self.CreateSphere.value:
            panel_group.hide_panels()

        self.old_sphere_state = self.CreateSphere.value
Beispiel #6
0
    def create_cow_changed(self):
        if self.CreateCow.value:
            transform_name = "transformObject" + str(self.actual_object_num)
            wobble_name = "wobbleObject" + str(self.actual_object_num)
            drag_name = "dragObject" + str(self.actual_object_num)

            state_set = avango.osg.nodes.StateSet()
            state_set.RescaleNormalMode.value = 1

            transform_object = avango.osg.nodes.LoadFile(
                Name=transform_name,
                Filename="/home/ddangelo/data/osgData/cow.osg",
                StateSet=state_set)
            drag_object = avango.osg.nodes.MatrixTransform(Name=drag_name)
            inspector_object = avango.osg.nodes.MatrixTransform(
                Name=wobble_name)

            drag_object.Children.value.append(inspector_object)
            inspector_object.Children.value.append(transform_object)

            transform_object.add_and_init_field(avango.script.SFObject(),
                                                "MenuToolBehavior",
                                                object_behavior)

            object_root.Children.value.append(drag_object)

            self.actual_object_num += 1

            inspector.update_model()

        # wait for button release to close menu - otherwise the widget will miss the button release,
        # because the widget is removed from panel before the button was released.
        if self.old_cow_state and not self.CreateCow.value:
            panel_group.hide_panels()

        self.old_cow_state = self.CreateCow.value