- Panda3d 1.7 Game Developer's Cookbook
- Christoph Lang
- 368字
- 2021-04-09 21:21:46
Inspecting and modifying the scene
Panda3D is a great engine for quickly developing prototypes of games, because creating and modifying scenes works quick and easy. But sometimes quick is not fast enough and restarting the game to see a change taking effect is a frustrating and repetitive task. This is why Panda3D provides the scene explorer, which we will use in the following recipe.
Getting ready
The following instructions are going to modify the code created in the recipe Loading models and actors, which can be found in this chapter.
How to do it...
The following tasks will introduce you to the features of the scene explorer:
- Add the highlighted lines to
Application.py
:from panda3d.core import Vec3 from pandac.PandaModules import loadPrcFileData loadPrcFileData("", "want-directtools #t") loadPrcFileData("", "want-tk #t") class Application(ShowBase): def __init__(self):
- Press F6 to start the application. Next to the game window, you will see the screenshot similar to this:
- Push the Wireframe button to enable wireframe rendering.
- Select the Grid tab and enable the grid:
- Go to the Tasks tab and push the Update button to watch all active tasks:
- Expand the PandaNode DIRECT node in the tree view on the left side of the window. You will see the following tree:
- Right-click the ModelRoot teapot.egg node and click Place to open the Placer Panel enter the values from the following screenshot:
- Click Placer | Print info to output your settings to Netbeans' Output pane:
- Close the Placer Panel.
- Left-click ModelRoot teapot.egg in the tree view to make it the active selection.
- Right-click ModelRoot teapot.egg and click Set Color.
- In the RGBA Panel, set the following values:
- Click the Print to Log button to output the color value to the Output pane of Netbeans.
How it works...
The scene explorer is enabled in the first step by setting the configuration flags want-directtools
and want-tk
at runtime using the loadPrcFileData()
function.
Although it will never be able to replace a proper level editor, the scene explorer can come in very handy to quickly place objects, especially if you use the buttons to print your settings to the Output pane of Netbeans. These little snippets can then be copied and pasted to our code to make the changes permanent.
- VR新未來
- 超簡(jiǎn)單的攝影后期書
- ChronoForms 3.1 for Joomla! site Cookbook
- 中文版3ds Max 2016實(shí)用教程
- BlackBerry Enterprise Server 5 Implementation Guide
- SolidWorks快速入門教程(2022中文版)
- 深入理解OpenCV:實(shí)用計(jì)算機(jī)視覺項(xiàng)目解析(原書第3版)
- Learning the Yahoo! User Interface library
- Photoshop CS6平面設(shè)計(jì)實(shí)戰(zhàn)從入門到精通(經(jīng)典暢銷版)
- Revit建模進(jìn)階標(biāo)準(zhǔn)教程(實(shí)戰(zhàn)微課版)
- Photoshop 2020實(shí)戰(zhàn)從入門到精通(超值版)
- UML 2.0 in Action: A project/based tutorial
- Service Oriented Architecture with Java
- Premiere視頻編輯案例教程:Premiere Pro 2020(微課版·第2版)
- 設(shè)計(jì)必修課:中文版After Effects CC動(dòng)畫制作+視頻剪輯+特效包裝設(shè)計(jì)教程