26174 Commits

Author SHA1 Message Date
rdb
243d59bf37 workflow: Remove step to build host interrogate for emscripten
This is now fetched automatically by makepanda as of e50465e8303bb42c3ae656f5f896cb958eb2e4ed
2024-08-10 16:55:03 +02:00
rdb
8d2407d553 Delete cppparser and interrogate from tree
These tools now live in https://github.com/panda3d/interrogate/

See also #1074
2024-08-10 16:55:03 +02:00
rdb
ce4b79750c makepanda: Stop building interrogate
Instead, install it using pip.  If you don't like this, submit a PR or use CMake
2024-08-10 16:55:00 +02:00
rdb
c9cddb8d92 CMake: Stop building interrogate from tree
Instead, either build it externally (BUILD_INTERROGATE) or accept INTERROGATE_EXECUTABLE / INTERROGATE_MODULE_EXECUTABLE settings
2024-08-10 16:54:12 +02:00
rdb
e776c819b8 makewheel: Exclude interrogate from panda3d wheel
This will be available separately as panda3d-interrogate wheel, built from https://github.com/panda3d/interrogate

Fixes #1074

[skip ci]
2024-08-10 13:00:53 +02:00
Drew Rogers
37152710b7 showbase: Add functions to get interval for Iris Transitions 2024-08-09 15:05:43 +02:00
John C. Allwein
21b39da65d pythonTask: fix refcount leak of non-panda Future::done
A missing Py_DECREF on the future's "done" method
caused both the bound method and the underlying
self instance of the future to be leaked when
awaiting non-panda futures (such as _asyncio.Future).

This change includes a simple new test addition
to catch this in the future.
2024-08-08 21:51:03 -06:00
rdb
fc1d95ae1d dtoolbase: Add missing includes to pstrtod.cxx 2024-08-08 21:36:21 +02:00
rdb
abf0b38705 dtoolutil: Use string compare instead of strcmp in filename.I 2024-08-08 21:36:00 +02:00
rdb
23124dac07 x11: Fix missing _net_wm_name field due to bad merge 2024-08-07 23:39:20 +02:00
rdb
ad57762e9f Merge branch 'release/1.10.x' 2024-08-07 22:34:08 +02:00
rdb
057c3f5476 Update BACKERS.md
[skip ci]
2024-08-07 22:26:33 +02:00
rdb
8c8cbeea98 linmath: For repr, use as much precision as needed for roundtrip
Will use as few digits as is necessary to ensure that round-tripping the same number with pstrtod will result in the same vector.  This prevents eg. 3.3 formatting as 3.29999995 while still ensuring that two floats that are not equal (other than nan) are guaranteed to have a different string representation.

Uses a hacky pftoa function that can be abandoned as soon as we adopt C++17, which has to_chars that does what we need

Fixes #1671
2024-08-07 17:24:11 +02:00
rdb
ca7ba4eab3 py_panda: Add Dtool_GetPyTypeObject macro
This is a cleaner, future-proof way of accessing a Panda type as PyTypeObject pointer
2024-08-07 15:53:27 +02:00
rdb
b8d6c7a2ef workflow: Update macOS-11 to macOS-12 runner 2024-08-07 11:57:19 +02:00
rdb
46833e9144 Update BACKERS.md
[skip ci]
2024-08-07 11:56:55 +02:00
rdb
1cc0676e41 dtoolutil: Fix misnamed include guard 2024-08-04 17:08:45 +02:00
rdb
58ea174eb2 interrogate: Use the limited Python API for simple Python back-end 2024-08-03 21:50:19 +02:00
rdb
0215b02985 interrogate: Replace a use of std::cerr with nout 2024-08-03 16:36:55 +02:00
rdb
ae04533527 dtoolutil: Fix typo in error message 2024-08-03 16:36:37 +02:00
rdb
7a13d86d93 CMake: remove vestigial HAVE_ROCKET_PYTHON macro 2024-08-03 15:00:44 +02:00
rdb
17fbd09250 workflow: Change macOS-11 runner to macOS-12 2024-08-03 12:18:16 +02:00
rdb
122453811d glgsg: Fix clear of offscreen buffer if back buffers requested 2024-06-30 11:53:17 +02:00
rdb
b6ec48b27c Fix invalid metadata version 2.0 (should be 2.1) 2024-05-28 22:28:37 +02:00
rdb
105f938d68 interrogate: Fix non-deterministic order of external import types
Fixes #1651
2024-05-28 11:11:21 +02:00
rdb
a655784d8d x11: attempt to fix UTF-8 window titles (see #209) 2024-05-16 20:30:27 +02:00
rdb
adb9242885 glgsg: Fix faulty auto-merge 2024-05-14 23:19:46 +02:00
rdb
b6515c881c Merge branch 'release/1.10.x' 2024-05-14 22:47:08 +02:00
rdb
0df17a00ca Merge branch 'bugfix/interrogate-gc-exception' of github.com:johnnyapol/panda3d 2024-05-14 22:46:53 +02:00
rdb
2436a06527 glgsg: Better error when invalid ShaderPtrSpec type is encountered 2024-05-14 22:45:01 +02:00
John C. Allwein
8cc62c9706 interrogate: avoid GC exceptions processing objects mid-construction
After 38692dd525525e20cd06204a646b35dd7e39902a, GC pauses occuring before
the __init__ function of the C++ backed object is called in a inheritance chain will
cause an exception during garbage collection and cause the python runtime to exit.

This can be observed by say, forcing a GC-pause in MetaInterval.__init__ before it calls CMetaInterval::__init__.
2024-05-14 09:48:55 -06:00
Wizzerinus
3ffcce2cc2 add getPlayMode() for actor and anim interface 2024-05-14 11:06:06 +02:00
Disyer
a9206041d9 ffmpeg: Use ch_layout in favor of removed channel_layout and channels
Closes #1641
2024-04-08 13:32:51 +02:00
rdb
5da013e2e9 text: Properly handle surrogate pairs in text on Windows
Fixes #1629
2024-04-08 12:12:00 +02:00
rdb
2adc167f26 windisplay: Fix regression related to fullscreen switching
Fixes #1594
2024-04-08 11:29:43 +02:00
rdb
ee9b0b9c78
readme: Change placement of logo subtly
[skip ci]
2024-04-01 22:30:17 +02:00
rdb
96e2e7d357 tests: Remove testing for AssertionError
This crashes with `assert-abort` and doesn't work with release builds
2024-03-29 20:57:36 +01:00
rdb
5cad92cd56 interrogate: Fix missing header to fix non-unity build 2024-03-29 20:57:12 +01:00
rdb
e5bd00f91f task: Implement garbage collector support for PythonTask
This adds persistent wrapper support (introduced by the previous commit) to PythonTask, which makes it possible for reference cycles involving tasks to be found and destroyed.

The major caveat is that it always creates a reference cycle.  This can be broken automatically if there is no more Python reference to it by the time the last C++ reference is dropped, but the other way around requires the garbage collector.

For tasks, I think this it is generally the case that the last reference is in C++, since tasks are usually created and then handed off to the C++ task manager, and for applications that don't want to rely on the GC, it is easy to work around.  If this turns out to be a problem, though, we can add a special garbage collection pass to the task manager.
2024-03-29 20:51:45 +01:00
rdb
38692dd525 interrogate: Support subclassing C++ objects from Python
This change enables persistent Python wrapper objects for Python subclasses of typed, reference counted C++ objects.  That means that these objects will store a reference to `self` on the C++ object, and interrogate will always return that instead of making a new Python wrapper every time it is returned from C++.

Practically, this means that you could subclass eg. PandaNode, Event, Fog, what have you, and store these in the scene graph - the Python data in the subclass will be retained and Panda will return your subclass when you ask for the object back rather than creating a new wrapper object without your original data.

To do this, Interrogate generates a proxy class inheriting from the C++ type with additional room to store a `self` pointer and a TypeHandle (which is returned by an overridden `get_type()`).  This TypeHandle is automatically created by registering the Python subclass with the typing system.  The proxy class is only used when the constructor detects that it's constructing for a subtype, so that regular uses of the C++ type are not affected by this mechanism.

(The registration with the typing system could use some improvement.  There's no regard for namespacing right now, in particular.  Furthermore, we could move the registration to an `__init_subclass__()` method, with parameters to specify an existing TypeHandle or to customize the type name.)

This creates a reference cycle, which must be cleared somehow.  One way this happens is by overriding `unref()` in the proxy, which checks that if the Python and C++ reference counts are both 1, this must be the circular reference, and then it breaks the cycle.  Note that this will _only_ work if all other Python references have been cleared before the last C++ reference goes away.  For the other case, we need to rely on Python's garbage collector, so these classes also implement tp_traverse and tp_clear.

This commit also therefore re-enables Python garbage collector support (ie. defining `__traverse__()`), which was previously disabled due to the problems caused by multiple Python wrappers referring to the same C++ object.  To avoid these problems, Panda will only cooperate with Python's GC if the C++ reference count is 1, in which case we can trivially prove that the last reference must be from the Python wrapper.  Note that this explains why we need persistent wrappers for traversal to work--if there are multiple Python wrappers pointing to the C++ object, and they are all participating in a reference cycle, the reference count cannot be 1, and cycle detection does not work.  By default, the GC is only enabled for Python subclasses, but a class may define `__traverse__()` in order to opt-in, keeping the previous limitation in mind.

There is a second mechanism introduced by this commit: classes may define a public `__self__` member of type `PyObject *` if they want to use persistent objects even if they aren't being subclassed.  This allows these classes to participate in Python's GC and avoid the situation above.

The cycle detection is implemented for PandaNode's Python tags, but this is very incomplete, since the traversal doesn't recurse into children and it won't work if there is more than one wrapper object that is part of a cycle, since PandaNode by default doesn't use persistent wrappers.  This problem may need more attention later.

Fixes #1410
2024-03-29 20:51:34 +01:00
rdb
33cef0aca3 pgraph: Disable non-working __traverse__() on NodePath 2024-03-29 17:15:43 +01:00
rdb
61665dc8ba cppparser: Remove unused <list> include 2024-03-29 16:12:01 +01:00
rdb
4430f16cda cppparser: Minor performance improvements 2024-03-29 16:04:04 +01:00
rdb
12a188b116 cppparser: Allow move semantics for CPPToken
This should make it a bit more efficient to move tokens around
2024-03-29 15:00:39 +01:00
rdb
e1870047c6 cppparser: In preprocess mode, add newline when switching files 2024-03-29 14:59:50 +01:00
rdb
329fa728a7 cppparser: Change check_keyword() to an unordered_set lookup 2024-03-29 13:04:24 +01:00
rdb
a3745af451 parser-inc: additions to sys/stat.h and signal.h 2024-03-29 13:01:40 +01:00
rdb
04a9264e68 cppparser: Fix slow parser performance 2024-03-29 12:22:54 +01:00
rdb
acf118c96a cppparser: Update prebuilt bison files 2024-03-29 12:19:48 +01:00
rdb
c1e494c083 cppparser: Fix volatile keyword not being parsed in all places 2024-03-29 11:39:51 +01:00