Commit Graph

61 Commits

Author SHA1 Message Date
baldurk 91d8c30cd3 Fix python object conversion for NULL QWidgets 2020-11-18 13:11:58 +00:00
baldurk 804fddcdf7 Allow python extensions to be loaded from app folder as well as user
* This will let us distribute extensions with the renderdoc builds.
2020-11-10 13:57:27 +00:00
baldurk 716c72f399 Remove custom FindPySide2.cmake, rely on normal packaging
* It seems PySide2 packaging is much more stable now, so we can generally rely
  on the distro packages.
2020-08-28 19:06:06 +01:00
baldurk 285c4b95df Add Qt5Qml.dll stub for 32-bit pyside2 distribution
* When the pyside2 we ship was built it accidentally included a small dependency
  on Qt5Qml, which we don't distribute so the pyside2 libraries wouldn't load.
* We can generate a tiny stub with the right exports and load it manually from
  the PySide2 folder on 32-bit qrenderdoc builds to allow pyside2 to load
  subsequently. The stub source is tiny, and added alongside.
* Putting it in the PySide2 folder means that even if someone puts RenderDoc's
  build folder in their PATH, our stub Qt5Qml won't break anything because it
  won't be loaded. If they put PySide2 in the PATH it might, but then it's their
  fault!
2020-08-28 19:06:05 +01:00
baldurk 36d74b32b9 Add optional output file for qrenderdoc unit tests 2020-06-11 20:06:43 +01:00
baldurk 14dc2a57f6 Fix refcounting on python traceback object 2020-03-06 17:56:27 +00:00
baldurk 7d4685fc17 Fix exception catch-and-rethrow in extension BlockInvoke. Closes #1721 2020-02-13 11:01:45 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk 14d01ff995 Remove support for serialising STL types, remove STL interop 2019-12-16 18:10:32 +00:00
baldurk ec7a852582 Refactor and improve rdcarray/rdcstr interface
* We are going to replace all std::string/std::vector use with these.
2019-12-16 17:06:15 +00:00
baldurk ff08748238 Ensure all files have trailing new-lines and enforce with clang warning 2019-12-02 20:28:05 +00:00
baldurk c67995b85a Make it easier to run tests from within UI 2019-09-20 11:20:45 +01:00
baldurk 699f8753af Convert ToStr, Serialise, and TypeName to use literal strings 2019-05-15 14:12:17 +01:00
baldurk a9a64242f6 Don't crash if python output happens without a stack frame
* This can happen if SyntaxWarning message are printed during parsing before
  execution.
2019-04-16 19:33:57 +01:00
baldurk 72d3c0ee3e Set 'pyrenderdoc' global after extension registration. Closes #1291 2019-03-01 08:32:35 +00:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk e437919e78 Linux compile fixes 2018-10-23 19:11:22 +01:00
baldurk 1720d321e5 Set general global handle for extension registration work
* When calling the register() function there is no frame or globals, so we need
  to set an internal handle external to that.
* This means functions that get wrapped know that there's a global handler for
  exceptions, which just prints to the log. Otherwise they think they're running
  synchronously and write to an invalid exception handling object.
2018-10-23 15:36:35 +01:00
baldurk 94dfb9890b Allow registering window, panel and context menu items with callbacks 2018-10-23 14:23:12 +01:00
baldurk dd3a352408 Add registration and loading of extensions through a management window 2018-10-23 14:23:11 +01:00
baldurk 2dd293d691 Add the ability to load/reload global python extensions 2018-10-23 14:23:11 +01:00
baldurk 21a7584c40 Don't import built-in renderdoc modules with prefixed underscores
* This prevents any modules loaded from doing 'import renderdoc' and having it
  work as expected.
2018-10-18 19:16:25 +01:00
baldurk 082ab4d75d GUIInvoke takes a QObject* to avoid callbacks after object lifetime
* The GUIInvoke object takes a QObject, and uses QPointer to check that
  it hasn't been deleted when the callback fires. This prevents delayed
  callbacks from executing after the object has been deleted and
  crashing.
* In most cases the pointer is just 'this'.
2018-05-08 11:54:34 +01:00
baldurk ab7fa9e281 Ignore python env vars which might load incompatible libs. Refs #902
* PYTHONHOME is used *ahead* of the python36.zip on Python's default
  search path, so we need to suppress that to make sure it doesn't
  interfere.
2018-03-07 22:18:55 +00:00
baldurk c1ceb3b02a Make PySide2 optional on windows
* It's already optional on linux due to distributions not necessarily
  carrying packages for it yet. We also make it optional on windows
  since by the same measure it's not a huge problem if it's missing, and
  official builds will include it. This means we don't have to ship the
  binary dependencies
2018-02-02 20:47:19 +00:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk 21d5943d82 Remove dependency on Qt in qrenderdoc python module
* The main addition here apart from some extra stubs is a new rdc type
  for date time objects.
* Although the module doesn't do anything and is only used for docs
  reflection it is desirable to not have to link against Qt as this
  can cause problems when linking the module without unresolved symbols.
2017-12-27 16:05:15 +00:00
baldurk a7398525b2 Add simple tab-completion in interactive python shell 2017-12-25 15:05:30 +00:00
baldurk 16f64a5ace Remove use of unnecessary swig generated .py wrappers
* These .py wrappers are relevant for the non-builtin path, but since we
  use -builtin they serve no purpose except to make things more complex.
* So instead we make the module directly exported as 'module' instead of
  '_module'.
* On windows there's no conflict because we have renderdoc.dll vs
  renderdoc.pyd. On linux it's librenderdoc.so vs renderdoc.so.
* To prevent supporting files like .lib / .pdb from conflicting on
  windows we build the python modules into a subdirectory. They're not
  ever used by the UI (it links in the bindings directly).
2017-12-25 15:05:28 +00:00
baldurk 417a811fad Expand docstring checks to also check names of symbols in the interface 2017-12-22 14:41:43 +00:00
baldurk 0b3d56f9f9 Ensure python global shutdown after context has closed 2017-12-19 17:32:12 +00:00
baldurk 657c343ac8 Support multi-line input in the python shell 2017-11-20 20:01:02 +00:00
Cory Bloor 58b628ee8b Fix unused variables
In almost all cases these can be removed. The only exception is in
ShaderViewer.cpp, where regIdx should have been used.
2017-11-18 00:17:06 +01:00
baldurk 8c74c92079 Move docstring check from fatal-onstart-hack to unit test run by CI 2017-10-02 15:54:23 +01:00
baldurk 3d11c502f5 Don't use SWIG_BUILTIN_INIT for passing SWIG ptrs, use SWIG_POINTER_OWN
* The former is only needed inside tp_init of a new object. Instead when
  we want to pass in and own a pointer, we use SWIG_POINTER_OWN.
* This also removes the need to pass 'self' all the way down in
  ConvertToPy which tidies up a lot of code.
2017-09-29 12:11:15 +01:00
baldurk 3b02ea0a3b Turn off tracing after execution finishes
* This means the tracing isn't still lingering around when we shutdown
  and the context is destroyed.
2017-09-11 20:23:55 +01:00
baldurk ef84f494a2 Add a macro that enables qt-compatibility in the renderdoc replay API
* This will be used to remove the ToQStr everywhere (where it's not
  used for actual stringification of enums/structs)
2017-08-16 18:28:11 +01:00
baldurk ee67b85b58 When we hit an exception, pass the line number of the top-of-stack
* This allows us to update the current line highlight before stopping.
2017-08-03 17:57:24 +01:00
baldurk 87ef595cce For a block invoke to another thread, safe and restore
* In future we could handle async exceptions by storing the exception
  information in a std::function derived object (instead of the separate
  ExceptionHandling that lives on the stack) and query it out in a new
  WaitForInvoke function maybe. Right now we just print the exception
  to the output log and abort the callback.
2017-08-03 17:57:23 +01:00
baldurk 1c93ee9441 If a python error has occurred, don't try to do any work, just bail 2017-08-03 17:57:22 +01:00
baldurk a11a00a7b5 Make sure Qt objects are deleted on the Qt main thread 2017-07-17 12:36:20 +01:00
baldurk 0b1c3725b9 Add a fallback path for opaque qwidgets if pyside2 isn't compiled in
* Even if we don't have pyside2 to treat qwidgets as full objects and
  access their methods and data, we still need to be able to pass around
  the QWidget* as an opaque pointer to be able to use the API properly.
* This change falls back to just using SWIG's default opaque pointer
  wrapping and unwrapping when pyside2 isn't available.
2017-06-09 17:02:09 +01:00
baldurk 8b3c06ac67 QStringLiteral compile fix for static qrenderdoc code 2017-05-03 08:53:56 +01:00
baldurk 0ecc6ca877 Enable QT_NO_CAST_FROM_ASCII & QT_NO_CAST_TO_ASCII
* Added a couple of utility macros to help with the conversion. lit() is
  paired with tr() for untranslated text.
* QFormatStr is more explicitly for non-textual formatting strings.
* Both are just #define'd to QStringLiteral()
2017-05-02 22:58:12 +01:00
baldurk 829e1aa77e Fix handling of 'slots' Qt keyword clashing with python
* On linux without any PCH we have a slightly different case to windows
  with the PCH, so we need to be careful not to redefine the macro.
2017-04-28 19:36:09 +01:00
baldurk 1f8a93c37a Add precompiled header file use to qrenderdoc on VS 2017-04-28 18:36:55 +01:00
baldurk 8824e18b0a Search share/renderdoc/pylibs for python libs.
* This is only relevant for static qrenderdoc builds where the python
  used isn't the system python, so it needs to locate its libs.
  Otherwise the system libpython3.so and libs will be used.
2017-04-19 18:07:56 +01:00
baldurk d51091e893 Pass in (char *) params to a couple of functions for backwards-compat
* Earlier python headers specified these parameters as char * instead of
  const char * so we get compile warnings passing in literals.
2017-04-19 18:07:53 +01:00
baldurk 5a432747c7 Don't set Py_TPFLAGS_HAVE_FINALIZE when we don't implement tp_finalize 2017-04-19 18:07:52 +01:00
baldurk 2a4596e06a Add python shell qt window 2017-04-19 18:03:19 +01:00