How to use the panda3d.core.VBase4 function in Panda3D

To help you get started, we’ve selected a few Panda3D examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github panda3d / panda3d / samples / gamepad / device_tester.py View on Github external
def refresh_device_menu(self):
        self.devices_frame['canvasSize'] = VBase4(
            0,
            base.a2dLeft*-0.75,
            base.a2dBottom / 5.0 * len(self.buttons),
            0,
        )
        self.devices_frame.setCanvasSize()
        sorted_buttons = sorted(self.buttons.items(), key=lambda i: i[0].name)
        for idx, (dev, button) in enumerate(sorted_buttons):
            button.set_pos(
                0,
                0,
                (base.a2dBottom / 5.0) * idx,
            )
github panda3d / panda3d / samples / gamepad / device_tester.py View on Github external
def add_button(offset, button_name):
                button_width = canvas_width / 2
                label = DirectLabel(
                    text=button_name,
                    **left_aligned_small_text,
                    pos=(0.05, 0, offset),
                    parent=panel_canvas,
                )
                button = DirectFrame(
                    frameSize=VBase4(
                        0,
                        button_width,
                        -0.1,
                        0,
                    ),
                    text="",
                    text_align=TextNode.ACenter,
                    text_scale=0.05,
                    text_fg=VBase4(0,0,0,1),
                    text_pos=(button_width / 2, -0.06),
                    frameColor=VBase4(0.3, 0.3, 0.3, 1),
                    pos=(canvas_width - button_width, 0, offset),
                    parent=panel_canvas,
                )
                return button
github panda3d / panda3d / samples / gamepad / mappingGUI.py View on Github external
incMaps.find("**/inc_disabled"))
        decMaps = loader.loadModel("models/dec_map")
        decGeom = (
            decMaps.find("**/dec_ready"),
            decMaps.find("**/dec_click"),
            decMaps.find("**/dec_hover"),
            decMaps.find("**/dec_disabled"))

        # create the scrolled frame that will hold our list
        self.lstActionMap = DirectScrolledFrame(
            # make the frame occupy the whole window
            frameSize=VBase4(base.a2dLeft, base.a2dRight, 0.0, 1.55),
            # make the canvas as big as the frame
            canvasSize=VBase4(base.a2dLeft, base.a2dRight, 0.0, 0.0),
            # set the frames color to white
            frameColor=VBase4(0, 0, 0.25, 0.75),
            pos=(0, 0, -0.8),

            verticalScroll_scrollSize=0.2,
            verticalScroll_frameColor=VBase4(0.02, 0.02, 0.02, 1),

            verticalScroll_thumb_relief=1,
            verticalScroll_thumb_geom=thumbGeom,
            verticalScroll_thumb_pressEffect=False,
            verticalScroll_thumb_frameColor=VBase4(0, 0, 0, 0),

            verticalScroll_incButton_relief=1,
            verticalScroll_incButton_geom=incGeom,
            verticalScroll_incButton_pressEffect=False,
            verticalScroll_incButton_frameColor=VBase4(0, 0, 0, 0),

            verticalScroll_decButton_relief=1,
github Toontown-School-House / Toontown-School-House / toontown / coghq / DistributedBanquetTable.py View on Github external
def fireWater(self, origin, target):
        color = VBase4(0.75, 0.75, 1, 0.8)
        dScaleUp = 0.1
        dHold = 0.3
        dScaleDown = 0.1
        horizScale = 0.1
        vertScale = 0.1
        sprayTrack = self.getSprayTrack(color, origin, target, dScaleUp, dHold, dScaleDown, horizScale, vertScale)
        duration = self.squirtSfx.length()
        if sprayTrack.getDuration() < duration:
            duration = sprayTrack.getDuration()
        soundTrack = SoundInterval(self.squirtSfx, node=self.waterPitcherModel, duration=duration)
        self.fireTrack = Parallel(sprayTrack, soundTrack)
        self.fireTrack.start()
github fireclawthefox / DirectGuiDesigner / DirectGuiDesignerToolbox.py View on Github external
def __makeToolboxCenteredListItem(self, displayName, index):
        item = DirectFrame(
            text=displayName,
            frameSize=VBase4(-self.toolsFrame["frameSize"][1]/2-10, self.toolsFrame["frameSize"][1]/2-10, -10, 20),
            frameColor=VBase4(0.85,0.85,0.85,1),
            text_align=TextNode.ACenter,
            text_scale=16,
            text_pos=(0, 0),
            pos=(self.toolsFrame["frameSize"][1]/2-10, 0, -30 * index + 10),
            state=DGG.NORMAL,
            #suppressMouse=0
            )
        return item
github Toontown-School-House / Toontown-School-House / toontown / coghq / DistributedBanquetTable.py View on Github external
def __displayPitcherAdvice(self, task):
        if self.pitcherAdviceLabel == None:
            self.pitcherAdviceLabel = DirectLabel(text=TTLocalizer.BossbotPitcherAdvice, text_fg=VBase4(1, 1, 1, 1), text_align=TextNode.ACenter, relief=None, pos=(0, 0, 0.69), scale=0.1)
        return
github fireclawthefox / DirectGuiDesigner / DirectGuiDesignerToolbox.py View on Github external
def __makeToolboxListItem(self, displayName, name, index):
        item = DirectButton(
            text=displayName,
            frameSize=VBase4(self.toolsFrame["frameSize"][0], self.toolsFrame["frameSize"][1]-20, -10, 20),
            frameColor=(VBase4(1,1,1,1), #normal
                VBase4(0.9,0.9,0.9,1), #click
                VBase4(0.8,0.8,0.8,1), #hover
                VBase4(0.5,0.5,0.5,1)), #disabled
            text_align=TextNode.ALeft,
            text_scale=12,
            text_pos=(self.toolsFrame["frameSize"][0], 0),
            pos=(0, 0, -30 * index + 10),
            relief=DGG.FLAT,
            command=self.__createControl,
            extraArgs=[name],
            #suppressMouse=0
            )
        return item
github pycollada / pycollada / examples / panda_display_collada.py View on Github external
def getStateFromMaterial(prim_material):
    state = RenderState.makeFullDefault()
    
    mat = Material()
    
    if prim_material:
        for prop in prim_material.supported:
            value = getattr(prim_material, prop)
            if value is None:
                continue
            
            if type(value) is tuple:
                val4 = value[3] if len(value) > 3 else 1.0
                value = VBase4(value[0], value[1], value[2], val4)
            
            if isinstance(value, collada.material.Map):
                image_data = value.sampler.surface.image.data
                if image_data:
                    myImage = PNMImage()
                    myImage.read(StringStream(image_data), posixpath.basename(value.sampler.surface.image.path))
                    myTexture = Texture(value.sampler.surface.image.id)
                    myTexture.load(myImage)
                    state = state.addAttrib(TextureAttrib.make(myTexture))
            elif prop == 'emission':
                mat.setEmission(value)
            elif prop == 'ambient':
                mat.setAmbient(value)
            elif prop == 'diffuse':
                mat.setDiffuse(value)
            elif prop == 'specular':
github fireclawthefox / DirectGuiDesigner / DirectGuiDesignerStructure.py View on Github external
command=self.__collapseElement,
                        extraArgs=[elementInfo],
                        image="icons/Collapsed.png" if elementInfo in self.collapsedElements else "icons/Collapse.png",
                        uncheckedImage="icons/Collapse.png",
                        checkedImage="icons/Collapsed.png",
                        image_scale=8,
                        isChecked=elementInfo in self.collapsedElements,
                        parent=self.structureFrame.getCanvas())
                    btnC.setTransparency(TransparencyAttrib.M_alpha)
                    btnC.bind(DGG.MWDOWN, self.scroll, [0.01])
                    btnC.bind(DGG.MWUP, self.scroll, [-0.01])

            # Element Name
            btn = DirectButton(
                frameColor=(VBase4(1,1,1,1), #normal
                    VBase4(0.9,0.9,0.9,1), #click
                    VBase4(0.8,0.8,0.8,1), #hover
                    VBase4(0.5,0.5,0.5,1)), #disabled
                text=elementInfo.name,
                text_align=TextNode.ALeft,
                relief=DGG.FLAT,
                pos=(self.structureFrame["frameSize"][0] + 20*parentsLevel, 0, z),
                scale=16,
                command=self.__selectElement,
                extraArgs=[elementInfo],
                parent=self.structureFrame.getCanvas())
            btn.bind(DGG.MWDOWN, self.scroll, [0.01])
            btn.bind(DGG.MWUP, self.scroll, [-0.01])
            if self.selectedElement is not None and self.selectedElement == elementInfo:
                btn.setColorScale(1,1,0,1)

            # Delete Button
github fireclawthefox / DirectGuiDesigner / DirectGuiDesignerToolbox.py View on Github external
def __makeToolboxCenteredListItem(self, displayName, index):
        item = DirectFrame(
            text=displayName,
            frameSize=VBase4(-self.toolsFrame["frameSize"][1]/2-10, self.toolsFrame["frameSize"][1]/2-10, -10, 20),
            frameColor=VBase4(0.85,0.85,0.85,1),
            text_align=TextNode.ACenter,
            text_scale=16,
            text_pos=(0, 0),
            pos=(self.toolsFrame["frameSize"][1]/2-10, 0, -30 * index + 10),
            state=DGG.NORMAL,
            #suppressMouse=0
            )
        return item