Commit Graph

7150 Commits

Author SHA1 Message Date
rdb 886e1c2f16 general: fix many compilation warnings in GCC 8 2018-06-19 00:37:28 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards 5e82671084 general: Do away with TYPENAME macro 2018-06-03 16:36:34 -06:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
rdb e0245d2777 First step towards eliminating `using namespace std;` (#335) 2018-06-03 20:32:23 +02:00
rdb 6b726fa697 general: fix various compiler warnings and issues exposed thereby 2018-05-30 11:09:35 +02:00
rdb 8c80ff1681 Audio3DManager: remove sounds when attached object is deleted
This now uses WeakNodePaths in order to prevent holding a reference to the corresponding nodes.

Closes #145
2018-05-20 18:46:27 +02:00
rdb 140644d8b6 stdpy: add Python 3 stuff to glob module, remove re dependency 2018-05-20 11:50:32 +02:00
rdb 71eee6df3f showbase: make iris/fade/letterbox transitions awaitable
This allows using a coroutine to build up a more complex sequence including transitions (eg. scripted cutscene), as well as provide a standard way to register callbacks upon completion of the transition.
2018-05-05 23:05:50 +02:00
rdb cf58de4d04 showbase: make base.movie() awaitable (by returning a future) 2018-05-05 23:02:11 +02:00
rdb 11e21af52c showbase: fix iris/fade transitions for extreme aspect ratios
Fixes #311
2018-05-05 22:08:52 +02:00
rdb f986f8de1b showbase: add back clampScalar and PriorityCallbacks to PythonUtil
These were removed by 88dbb31daa under the assumption that they were not used, but it has recently come to my attention that there is still code out there that uses these.

PriorityCallbacks has been updated to be compatible with Python 3 by only comparing the priority, rather than the (priority, callback) tuple. This also has the side-effect of ditching the bisect dependency.

Also moves testing code from the source to the unit tests.
2018-04-21 11:43:46 +02:00
rdb e9ae7dcc40 Use vector_uchar instead of string for binary network/file data
This distinction allows us to better support Python 3, since it will raise exceptions when trying to put arbitrary binary data in a str object.

This also adds some convenience functions for efficiently initializing a Datagram or PTA_uchar from a vector_uchar.
2018-04-02 23:17:14 +02:00
Tohka 0b1ad67e13 distributed: Fix DC file reading regression (#295) 2018-03-31 04:01:35 -06:00
Sebastian Hoffmann 78377ca10c Cursor after newline character appears on beginning of next line.
DirectEntry.updateNumLines updates text geom.
DirectEntry API less inadequate.

Closes #257
2018-03-30 20:17:31 +02:00
Sam Edwards 4eb250cb87 dcparser: Write ranged-blob parameters correctly 2018-03-25 22:03:55 -06:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
Sam Edwards f231ba4cd7 directbase: Introduce BUILDING_ defines for each component
Ditto everything before, but for direct.
2018-03-25 13:17:52 -06:00
Michael Wass b10ee32752 direct: Fix some more NameErrors
Closes #274
2018-03-08 11:44:04 +01:00
rdb b0b32b9d6a direct: fix Python 3 support in Pmw-based tools
Fixes #276
2018-03-08 11:21:14 +01:00
Michael Wass 89799bc024 direct: Fix some NameErrors
Squashed merge of GitHub PR #273
2018-03-05 18:32:27 -07:00
Sam Edwards ac8417ffdf distributed: `type(x) == types.FooType` -> `inspect.isfoo(x)`
This is more compatible across Python 2 vs. 3.

[skip ci]
2018-03-04 15:28:39 -07:00
rdb b62435a373 general: remove all uses of deprecated upcastTo*() methods
These methods have not been needed for a very long time, so we should not encourage their use.
2018-02-27 15:02:49 +01:00
Sam Edwards b72d1c198f distributed: Fix the import test (and syntax on Python 3) 2018-02-23 19:52:48 -07:00
Sam Edwards f76b8a6ad8 distributed: Replace the OTP protocol format with Astron's
Again, all this does is affect the 4-years-disused OTP system, leaving
the CMU system entirely untouched.

This changes the packet formatting in several of distributed's helper
classes.
2018-02-23 16:45:50 -07:00
Sam Edwards 167c6dcafa distributed: Change the message numbers to match Astron's
I imagine very few Panda3D users depend on the message numbers having
particular values. The ones removed belonged to Disney's OTP system,
which hasn't been used by anybody in over 4 years.

At any rate, old code should continue to work, just at the cost of
compatibility between clients and servers running different P3D versions.
2018-02-23 16:35:50 -07:00
Sam Edwards 97368ec321 distributed: Make a few slight cleanliness changes
I brought all of these over from the Astron fork
2018-02-23 15:55:30 -07:00
Sam Edwards aaeb925e84 directtools: Fix typo in DirectSelection 2018-02-23 15:50:50 -07:00
rdb aa90b7b0c0 showbase: disable track-gui-items by default, remove want-e3-hacks 2018-02-23 22:26:27 +01:00
rdb e6c2d3b609 showbase: allow DirectGui elements to be created before ShowBase
This is done by precreating aspect2d inside ShowBaseGlobal.
2018-02-23 22:15:34 +01:00
rdb 0cf605ce7d showbase: move run() and __dev__ to ShowBaseGlobal
Also remove ShowBaseGlobal notify category, it doesn't really add anything
2018-02-23 21:26:49 +01:00
Sam Edwards e15cea4331 general: Remove more unnecessary +x UNIX modes 2018-02-07 11:29:48 -07:00
fireclawthefox f2cf391a2e gui: add simple way to enable overflow in DirectEntry
Closes #236
2018-01-24 19:17:50 +01:00
rdb bdb53b8cb5 showbase: fixes for aspect-ratio adjustment of pixel2d(p) 2018-01-05 19:49:14 +01:00
rdb 27fb1a4a9e showbase: fix aspect ratio calculation
backs out part of 7a46b2ca60, from PR #204
2018-01-05 15:00:21 +01:00
rdb c1679472cd actor: change parent of exposed joint to character
This prevents exposed joints from not being affected by a transform directly on the Character node.  See panda3d/panda3d#221 for more details.

Fixes #221
2018-01-05 14:39:39 +01:00
rdb 47c7ff42cc CommonFilters: better handle failure condition when shaders not supported 2018-01-05 14:15:22 +01:00
rdb 4f50f6abd0 showbase: use ShowBaseGlobal module as alternative to builtin scope
Allows accessing `base` object and several other builtins from the ShowBaseGlobal module.

It doesn't bother with builtins that are available as members of the base object such as `render` and `loader`.

Fixes #182
2018-01-03 14:25:27 +01:00
rdb 588d41ed7e Fix assorted compiler warnings 2017-12-24 15:12:58 +01:00
rdb ed5e5386b9 AsyncFuture improvements, incl. support for gathering futures 2017-12-21 14:07:01 +01:00
deflected e4a817b469 Loader: Fixed crash when canceling async loading of model
- Clean up the _loader after we clean up the requests,
        not before that

Signed-off-by: deflected <deflected@users.noreply.github.com>
2017-12-13 13:42:29 +02:00
deflected bdd53d60fc ShowBase: Fixed crash when want-render2dp is False
- Fixed crash in ShowBase when want-render2dp setting
        is set to 0(False).

Signed-off-by: deflected <deflected@users.noreply.github.com>
2017-12-04 22:46:30 +01:00
deflected 7a46b2ca60 ShowBase: Minor fixes over aspect ratio and size calculations
- Do not take into accound SBS if it is not enabled
        - Always return value for getSize()
        - Properly handle SBS for window-events
        - Redo positioning of aspect2d(p) markers exactly as
        they are created when adjusting aspect ratio

Signed-off-by: deflected <deflected@users.noreply.github.com>
2017-12-04 22:46:22 +01:00
rdb 2e20a0f16e Implement awaitable thread-safe future for async operations
This introduces AsyncFuture as a new base class of AsyncTask.  It's modelled after asyncio's Future class, except that it is thread-safe and you can use result() to block the current thread waiting for the future to finish (of course this is not necessary for use with coroutines).

AsyncFuture should be used for any operation that finishes in the future, to get the benefit of awaitability within coroutines as well as a standard interface for querying status and results of the operation as well as cancelling it.  As such, it's been implemented in various places, including texture.prepare() and win.trigger_copy().

Note that AsyncFuture is intended to be used *once*; it cannot be used more than once.  As an example of how this works, tex.prepare() will return the same future as long as the prepare isn't complete, but when it is done, subsequent calls to tex.prepare() will return a new future.
2017-12-04 22:25:28 +01:00
fireclawthefox 936ef1953c Small extensions for the mirror demo
Add extra parameters for buffer size and clear color
Add sample code at the bottom to display usage of mirror demo

Closes: #195
2017-11-12 00:19:50 +01:00
fireclawthefox feb36d9818 Fixed mirror demo
Set "mirror" camera to always have the same roll as the mirror
-> otherwise the model in the mirror will move unexpectedly
Set y coordinate of the mirror corners to the cameras distance
-> This fixes a crash and keep the mirrored model at correct sizer

Closes: #194
2017-11-12 00:15:58 +01:00
fireclawthefox 649a9abf8d Fix initial usage of letterbox
Set start position of letterbox frames to the hidden position

Closes: #193
2017-11-12 00:06:13 +01:00
rdb dd2806c8bd Mark constructors 'explicit' for which coercion makes no sense 2017-11-06 19:47:38 +01:00
rdb 3f0ab1d198 interval: fix ActorInterval endFrame assignment when passing duration
Fixes: #187
2017-11-03 20:07:24 +01:00