Giter Site home page Giter Site logo

coin3d / pivy Goto Github PK

View Code? Open in Web Editor NEW
53.0 19.0 36.0 9.71 MB

python bindings to coin3d

License: ISC License

Python 87.57% C++ 1.00% Shell 0.08% Makefile 0.02% CMake 0.46% Rich Text Format 0.09% SWIG 9.38% Batchfile 0.01% C 1.39%
freecad coin3d opengl scenegraph python python3 graphics

pivy's Introduction

General build instructions:

Build Status

Starting with version 0.6.6 pivy it's possible to build pivy with cmake:

  $ cd pivy
  $ mkdir build
  $ cd build
  $ cmake ..
  $ make

Alternative it's still possible to use distutils:

  $ python3 setup.py build
  $ python3 setup.py install

For older system/distros please use the setup_old.py script to build pivy.

Reporting bugs:

Please submit bug reports, feature requests, etc. to the Pivy issue tracker.

Contact:

If you have any questions regarding Pivy or simply want to discuss with other Pivy users, you can do so at the general coin-discuss mailinglist.

pivy's People

Contributors

andrewammerlaan avatar antonok-edm avatar casselineau avatar cclauss avatar gerhardr avatar kkremitzki avatar lgtm-com[bot] avatar looooo avatar luzpaz avatar marioalexis84 avatar peterlama avatar podsvirov avatar sebjf avatar stefanbruens avatar tuhtah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pivy's Issues

Failed to build pivy 0.6.6.a0 with SWIG 4.0.0 or 4.0.2

Build Host: Debian 10 x86_64
SWIG: 4.0.0 or 4.0.2
Pivy: 0.6.6.a0

cmake:

error message:

build_pivy/Release/pivy/coinPYTHON_wrap.cxx: In function ‘PyObject* _wrap_SbString_vsprintf(PyObject*, PyObject*)’:
build_pivy/Release/pivy/coinPYTHON_wrap.cxx:9587:15: error: invalid array assignment
 arg3 = *temp; 

Coin3D: 4.0.0
Python3: 3.5.9
CMakeCache.txt

Error loading libCoin library.

Following the instructions from: https://www.freecadweb.org/wiki/Python_3, specifically the Test builds on anaconda (linux64) part.

I get the following error:

>>> import pivy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/acct/local/miniconda3/envs/freecad_py3/lib/python3.6/site-packages/pivy/__init__.py", line 30, in <module>
    from .coin import SoDB, SoNodeKit, SoInteraction
  File "/home/acct/local/miniconda3/envs/freecad_py3/lib/python3.6/site-packages/pivy/coin.py", line 21, in <module>
    from . import _coin
ImportError: libCoin.so.80: cannot open shared object file: No such file or directory

These are the conda package versions:

coin3d                    4.0.0                h83d4a3d_4    conda-forge
pivy                      0.6.5a2          py36hc9558a2_0    conda-forge

I have the following file:
/home/acct/local/miniconda3/envs/freecad_py3/lib/libCoin.so.4.0.0

If I create a softlink from libCoin.so.4 -> libCoin.so.80 I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/acct/local/miniconda3/envs/freecad_py3/lib/python3.6/site-packages/pivy/__init__.py", line 30, in <module>
    from .coin import SoDB, SoNodeKit, SoInteraction
  File "/home/acct/local/miniconda3/envs/freecad_py3/lib/python3.6/site-packages/pivy/coin.py", line 21, in <module>
    from . import _coin
ImportError: /home/acct/local/miniconda3/envs/freecad_py3/lib/python3.6/site-packages/pivy/_coin.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK7SbPList4findEPKv

This is preventing me from doing a '.obj' export, which I hope will include mesh colors.

SoCoordinateElement.getInstance() doesn't work in event handler context

SoCoordinateElement.getInstance(state) is meant to retrieve the coordinate data from the top of the scenegraph stack. But this doesn't seem to work in an event handler context. I'm trying to do something along these lines:

class MyObj(SoSeparator):
    def __init__(self):
        self.events = coin.SoEventCallback()
        self += self.events
        self.events.addEventCallback(coin.SoKeyboardEvent.getClassTypeId(), self.key_cb)

    def key_cb(self, attr, key_event):
        state = key_event.getAction().getState()
        co_el = coin.SoCoordinateElement.getInstance(state)

...

coords = coin.SoCoordinate3()
coords.point.setValues(...)
scene += coords
scene += MyObj()

But this results in co_el == None in the event callback. Am I doing something wrong? Or is there some other way to get the coordinate data in this context?

Typings for mypy

Is there any chance pivy typings could be provided without too much effort? Or maybe such a typing package already exists?

E.g. like this

class SbVec3f:
    def __init__(self): ...
    def getValue(self) -> Tuple[float, float, float]: ...

class SoSFVec3f:
    def __init__(self): ...
    def getValue(self) -> SbVec3f: ...
    def setValue(self, value: Sequence[float]) -> None: ...

class SbRotation:
    def __init__(self): ...

class SoSFRotation:
    def __init__(self): ...
    def setValue(self, value: List[float]) -> None: ...

class SoCamera:
    position: SoSFVec3f
    orientation: SoSFRotation

    def __init__(self): ...

win: not working examples

  • 09.1:
python 09.1.Print.py 01.1.Windmill.iv test.ps
To print the scene: press the 'p' key while in picking mode
Traceback (most recent call last):
  File "09.1.Print.py", line 145, in <module>
    main()
  File "09.1.Print.py", line 129, in main
    viewer = SoGuiExaminerViewer(appWindow, "None", TRUE, SoGuiExaminerViewer.BUILD_ALL, SoGuiExaminerViewer.EDITOR)
AttributeError: type object 'SoGui_Quarter_Wrapper' has no attribute 'BUILD_ALL'
  • 09.4:
python 09.4.PickAction.py
Traceback (most recent call last):
  File "09.4.PickAction.py", line 131, in <module>
    main()
  File "09.4.PickAction.py", line 113, in main
    myViewer.setViewing(0)
AttributeError: 'SoGui_Quarter_Wrapper' object has no attribute 'setViewing'
  • 10.6
python 10.6.PickFilterTopLevel.py
Traceback (most recent call last):
  File "10.6.PickFilterTopLevel.py", line 95, in <module>
    main()
  File "10.6.PickFilterTopLevel.py", line 81, in main
    viewer2 = SoGuiExaminerViewer()
TypeError: __init__() missing 1 required positional argument: 'mainwindow'
  • 10.8 / 14.2 / 16.2
10.8.PickFilterNodeKit.py
The SoGuiMaterialEditor node has not been implemented in the SoGui bindings of Coin!
  • 13.2/3/8 (working but error printed)
python 13.2.ElapsedTime.py
TypeError: expected a sequence with 2 shorts
  • 13.4/5: some clicks are missing

  • 16.1

python 16.1.Overlay.py
Traceback (most recent call last):
  File "16.1.Overlay.py", line 79, in <module>
    main()
  File "16.1.Overlay.py", line 70, in main
    myViewer.setOverlayColorMap(1, 1, color)
AttributeError: 'SoGui_Quarter_Wrapper' object has no attribute 'setOverlayColorMap'
  • 17.1
python 17.1.ColorIndex.py
Traceback (most recent call last):
  File "17.1.ColorIndex.py", line 34, in <module>
    from OpenGL.GLX import *
  File "C:\Users\fc_builder\Miniconda3\envs\pivy\lib\site-packages\OpenGL\GLX\__init__.py", line 3, in <module>
    from OpenGL.GLX.VERSION.GLX_1_0 import *
  File "C:\Users\fc_builder\Miniconda3\envs\pivy\lib\site-packages\OpenGL\GLX\VERSION\GLX_1_0.py", line 14, in <mo
    from OpenGL.raw.GLX.VERSION.GLX_1_0 import *
  File "C:\Users\fc_builder\Miniconda3\envs\pivy\lib\site-packages\OpenGL\raw\GLX\VERSION\GLX_1_0.py", line 43, in
    @_p.types(ctypes.POINTER(_cs.XVisualInfo),ctypes.POINTER(_cs.Display),_cs.c_int,ctypes.POINTER(_cs.c_int))
  File "C:\Users\fc_builder\Miniconda3\envs\pivy\lib\site-packages\OpenGL\raw\GLX\VERSION\GLX_1_0.py", line 13, in
    return _p.createFunction( function,_p.PLATFORM.GLX,'GLX_VERSION_GLX_1_0',error_checker=_errors._error_checker)
AttributeError: 'Win32Platform' object has no attribute 'GLX'
  • 17.3
This example is not functional as it is GLX dependent!

Could not find a package configuration file provided by "Coin"

Hi, I am trying to build privy myself trying to fix an issue I am having with FreeCad with the Image Scaling that is complaining of something.

Then building it on my new (pre-released) Ubuntu 22.04 I am seeing this issue.
I don't know much about this Coin and it looks a pretty generic name to look for in Google. What is it? I want to understand this, to be able to solve this issue with this missing package.

CMake Error at CMakeLists.txt:10 (find_package):
  Could not find a package configuration file provided by "Coin" with any of
  the following names:

    CoinConfig.cmake
    coin-config.cmake

  Add the installation prefix of "Coin" to CMAKE_PREFIX_PATH or set
  "Coin_DIR" to a directory containing one of the above files.  If "Coin"
  provides a separate development package or SDK, be sure it has been
  installed.

Sensor callback (threading) still crashes with 64-bit Python3 on 64-bit Windows despite fix

Issue: Sensor callback still crashes for me using 64-bit Python3 on 64-bit Microsoft Windows

Scenario: despite using the fixes in branch "threads", the sensor callback problem still occurs using the following two configurations:

  • Python 3.6.1 (x64), Windows 10 (64-bit), MSVC14
  • Python 3.4.4 (x64), Windows 7 (64-bit), MSVC10

The test cases used where the following two Inventor Mentor examples:

  • 12.1.FieldSensor.py bird.iv (crash occurs when attempting to drag the bird)
  • 12.3.AlarmSensor.py (crash occurs after 12 secs when the asynchronous C++ callback is triggered)

Request: Could you please re-test the sensor callback threading fix also on a 64-bit Python3 configuration on a 64-bit Windows system and confirm that the current fix is working for you.

Many thanks in advance! Best wishes, Peter

Failed to compile

Any idea what could be the reason? It seems to be related to swig, but on the other hand, maybe the flag '-fpermissive' should be added for now when calling gcc from setup.py?

gcc: 8.2.0
python: 3.7.0
swig: 3.0.12

gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -Iy/coin_wrap.cpp -o build/temp.linux-x86_64-3.7/pivy/coin_wrap.o -Iinterfaces -I/usr/include -I/usr/include/Inventor/annex -Wno-unused -Wno-maybe
pivy/coin_wrap.cpp: In function ‘void SoSensorPythonCB(void*, SoSensor*)’:
pivy/coin_wrap.cpp:6342:40: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     sensor_cast_name = PyUnicode_AsUTF8(item);
                        ~~~~~~~~~~~~~~~~^~~~~~
pivy/coin_wrap.cpp: In function ‘void SoMarkerSet_addMarker__SWIG_3(int, const SbVec2s&, PyObject*, SbBool, SbBool)’:
pivy/coin_wrap.cpp:7236:43: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
             coin_marker = PyUnicode_AsUTF8(string);
                           ~~~~~~~~~~~~~~~~^~~~~~~~

New/delete vs malloc/free

In C++ you never should release memory with free() that was allocated with new() or release it with delete/delete[] that was allocated with malloc(). Although it works in most cases it's bad practice and there is no guarantee that it always works.

Recently I have built FreeCAD with the compiler option -fsanitize=address that is able to detect flaws like above. When running the unit tests there FreeCAD crashes and in the terminal a message appears like: alloc-dealloc-mismatch (malloc vs operator delete [])

I was able to reduce the crash to this little snippet:

from pivy import coin

node = coin.SoCoordinate3()
pts = []
pts.append([0, 0, 0])
node.point.setValues(pts)

In order to better locate the problem I have built pivy locally and then the utility directly pointed me to the line in the source code that causes the crash. It's the function _wrap_SoMFVec3f_setValues__SWIG_1 which contains this block:

arg3 = static_cast< int >(val3);
  {
    int len;
    if (PySequence_Check(obj3)) {
      len = PySequence_Length(obj3);
      temp4 = (float (*)[3]) malloc(len*3*sizeof(float));
      convert_SoMFVec3f_array(obj3, len, temp4);  
      arg4 = temp4;
    } else {
      PyErr_SetString(PyExc_TypeError, "expected a sequence.");
      arg4 = NULL;
    }
  }
  (arg1)->setValues(arg2,arg3,(float const (*)[3])arg4);
  resultobj = SWIG_Py_Void();
  {
    if (arg4) {
      delete[] arg4; 
    }
  }
  return resultobj;

As you can see the memory for temp4 is allocated with malloc, assigned to arg4 and this frees it with delete[] instead of free().

Since this is generated code I had a look at the file SoMFVec3f.i:

%typemap(in) const float xyz[][3] (float (*temp)[3]) {
  int len;
  if (PySequence_Check($input)) {
    len = PySequence_Length($input);
    temp = (float (*)[3]) malloc(len*3*sizeof(float));
    convert_SoMFVec3f_array($input, len, temp);  
    $1 = temp;
  } else {
    PyErr_SetString(PyExc_TypeError, "expected a sequence.");
    $1 = NULL;
  }
}

/* free the list */
%typemap(freearg) const float xyz[][3] {
  if ($1) { delete[] $1; }
}

So to fix the problem the freearg must be fixed with:

/* free the list */
%typemap(freearg) const float xyz[][3] {
  if ($1) { free($1); }
}

The same fix must be applied to SoMFVec3d.i, SoMFVec2f.i and SoMFVec4f.i. Other classes are not affected as far as I can see.

-fpermissive required to compile Swig generated cpp files

David Daish created an issue 2019-03-05

When the build script reached the point where the Swig generated coin_wrap.cpp files are compiled by GCC, the build would fail if it wasn't also given the flag -fpermissive.

I'm not an expert, but I believe this is unsafe, and I felt it appropriate to document this here.

Comments (1)

    John Soo

    I am experiencing this as well. Here is the error gcc gives:

    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/gnu/store/b7fqhszxl02g6pfm3vw6b3cjz472qrly-python-3.7.0/include/python3.7m -c pivy/coin_wrap.cpp -o build/temp.linux-x86_64-3.7/pivy/coin_wrap.o -Iinterfaces -I/gnu/store/l6mkj46jllqwl6i9ywzl0k5ks760wf30-coin3D-4.0.0a-1.8d860d7/include -I/gnu/store/l6mkj46jllqwl6i9ywzl0k5ks760wf30-coin3D-4.0.0a-1.8d860d7/include/Inventor/annex -Wno-unused -Wno-maybe-uninitialized
    pivy/coin_wrap.cpp: In function ‘void SoSensorPythonCB(void*, SoSensor*)’:
    pivy/coin_wrap.cpp:6342:40: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
         sensor_cast_name = PyUnicode_AsUTF8(item);
                                            ^
    pivy/coin_wrap.cpp: In function ‘void SoMarkerSet_addMarker__SWIG_3(int, const SbVec2s&, PyObject*, SbBool, SbBool)’:
    pivy/coin_wrap.cpp:7236:43: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
                 coin_marker = PyUnicode_AsUTF8(string);
                                               ^
    error: command 'gcc' failed with exit status 1

pivy 0.6.4: "checking for SOQT via cmake" fails under MacPorts

I'm trying to upgrade the MacPorts Portfile to version 0.6.4. (version 0.6.2 is currently available).

Unfortunately, the cmake check for SOQT fails. On further investigation, I find that there is no FindSoQt.cmake file provided by the SoQt port.

Example 10.6 [ported to Pivy-Quarter]: No "AS_IS" rendering in viewer1

Please find below my version of example 10.6 ported to pivy-Quarter.
Unfortunately, this example only works for me as long as viewer1 is set to wireframe rendering. However, if I leave the defaults or set the rendering mode explicitly to 'AS_IS' (smooth shading) [in the last couple of lines of this example], then the bench in viewer1 will not get rendered using pivy's implementation of class QuarterWidget. I would be most grateful for any suggestions how I can fix this issue. Many thanks indeed. Best regards and wishes!


"""
This is an example from The Inventor Mentor,
chapter 10, example 6.

This example demonstrates the use of the pick filter
callback to implement a top level selection policy.
That is, always select the top most group beneath the
selection node,  rather than selecting the actual
shape that was picked.
"""

import sys

from PySide.QtGui import *
from pivy.coin import *
from pivy.quarter import *

# Pick the topmost node beneath the selection node
def pickFilterCB(void, pick):
    # See which child of selection got picked
    p = pick.getPath()

    for i in range(p.getLength() - 1):
        n = p.getNode(i)
        if n.isOfType(SoSelection.getClassTypeId()):
            break

    # Copy 2 nodes from the path:
    # selection and the picked child
    return p.copy(i, 2)

def main():
    # Initialize Qt
    app = QApplication(sys.argv)
    # Inventor is already initialized when importing Coin by calling SoDB.init()
   
    # Open the data file
    input = SoInput()
    datafile = "parkbench.iv"
    if not input.openFile(datafile):
        sys.stderr.write("Cannot open %s for reading." % (datafile))
        sys.exit(1)

    # Read the input file
    sep = SoSeparator()
    sep.addChild(SoDB.readAll(input))
   
    # Create two selection roots - one will use the pick filter.
    topLevelSel = SoSelection()
    topLevelSel.addChild(sep)
    topLevelSel.setPickFilterCallback(pickFilterCB)

    defaultSel = SoSelection()
    defaultSel.addChild(sep)
    
    # Create two viewers, one to show the pick filter for top level
    # selection, the other to show default selection.
    viewer1 = QuarterWidget()
    viewer1.setSceneGraph(topLevelSel)
    boxhra1 = SoBoxHighlightRenderAction()
    viewer1.getSoRenderManager().setGLRenderAction(boxhra1)
    topLevelSel.addChangeCallback(viewer1.scheduleRedraw) # viewer1.redrawOnSelectionChange(topLevelSel)
    viewer1.setWindowTitle("Top Level Selection")

    viewer2 = QuarterWidget()
    viewer2.setSceneGraph(defaultSel)
    boxhra2 = SoBoxHighlightRenderAction()
    viewer2.getSoRenderManager().setGLRenderAction(boxhra2)
    defaultSel.addChangeCallback(viewer2.scheduleRedraw) # viewer2.redrawOnSelectionChange(defaultSel)
    viewer2.setWindowTitle("Default Selection")

    viewer1.show()
    viewer2.show()

    # Currently, viewer1 only works in wireframe mode
    viewer1.getSoRenderManager().setRenderMode(SoRenderManager.WIREFRAME)
    # However, the default ("as-is" / smooth) rendering option leaves viewer1 empty
    # viewer1.getSoRenderManager().setRenderMode(SoRenderManager.AS_IS)
    
    sys.exit(app.exec_())

if __name__ == "__main__":
    main()

Installation failure

Hello,

I have to install pivy for a Freecad workbench, but I have some trouble:
Ubuntu 17.10, fresh install:
I install freecad-daily.
Then:
pip install https://github.com/FreeCAD/pivy/archive/master.zip gives the following error:

` ~~~ HISSSSSSSSSS ~~~
Welcome to Pivy 0.6.3!
Building Pivy has never been so much fun!

Platform...linux2
Python version...2.7.14
Checking for swig...
not found.
Checking for swig3.0...
not found.

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-JRYOeQ-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-oYhwod-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-JRYOeQ-build/
`

Obviously, swig is missing, I install it, but then:

`Installing collected packages: Pivy
Running setup.py install for Pivy ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-tPN9u6-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-Cn1XBM-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build

                            _____
                        .-'`     '.
                     __/  __       \
                    /  \ /  \       |    ___
                   | /`\| /`\|      | .-'  /^\/^\
                   | \(/| \(/|      |/     |) |)|
                  .-\__/ \__/       |      \_/\_/__..._
          _...---'-.                /   _              '.
         /,      ,             \   '|  `\                \
        | ))     ))           /`|   \    `.       /)  /) |
        | `      `          .'       |     `-._         /
        \                 .'         |     ,_  `--....-'
         `.           __.' ,         |     / /`'''`
           `'-.____.-' /  /,         |    / /
               `. `-.-` .'  \        /   / |
                 `-.__.'|    \      |   |  |-.
                    _.._|     |     /   |  |  `'.
              .-''``    |     |     |   /  |     `-.
           .'`         /      /     /  |   |        '.
         /`           /      /     |   /   |\         \
        /            |      |      |   |   /\          |
       ||            |      /      |   /     '.        |
       |\            \      |      /   |       '.      /
       \ `.           '.    /      |    \        '---'/
        \  '.           `-./        \    '.          /
         '.  `'.            `-._     '.__  '-._____.'--'''''--.
           '-.  `'--._          `.__     `';----`              \
              `-.     `-.          `.''```                     ;
                 `'-..,_ `-.         `'-.                     /
                        '.  '.           '.                 .'


                            ~~~ HISSSSSSSSSS ~~~
                           Welcome to Pivy 0.6.3!
                 Building Pivy has never been so much fun!


Platform...linux2
Python version...2.7.14
Checking for swig...
'/usr/bin/swig'
Checking for SWIG version...
3.0.10
calling: cmake .
error: [Errno 2] No such file or directory

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-tPN9u6-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-Cn1XBM-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-tPN9u6-build/
`

Recursion in SoBaseKit.__getattr__

Hi,

I've been experimenting with the draggers in FreeCAD and encountered a (possibly) infinite recursion bug when using debugpy with pivy.

It seems to be that SWIG attempts to get the attribute 'this' from SoBaseKit, but the __getattr__ implementation unconditionally attempts to retrieve the catalog (SoBaseKit_getNodekitCatalog), which itself attempts to get this, and so on.
The error seems to be silently handled inside Pivy but becomes a problem when using the debugger.

There's further analysis by the debugpy team.

Adding a case as for __setattr__ that returns the SoNode implementation resolves this in the tests I've done.

def __getattr__(self,name):
       if name == 'this':
          return SoNode.__gettattr__(self,name)
       c = _coin.SoBaseKit_getNodekitCatalog(self)
       if c.getPartNumber(name) >= 0:
          part = self.getPart(name,1)
          return part
       return SoNode.__getattr__(self, name)

Though I don't know enough about SWIG to be sure this is the correct approach.

Transfer ownership of PyPi entry

Dear Pivy community,

Hope you are all fine.

I am amazed at all the great things you have done and created with Pivy. Love the fact that you kept it alive and wiggling. 🐍 The project is in good hands! 👍

@looooo I created a Pivy PyPi entry many years ago and was wondering if you are interested in having the ownership transferred to you?

Have fun,
Tamer.

example examiner_embed4.py not working with soqt (PySide port)

Using latest commit a0c3e84, Soqt port (#17) , replacing line 34 in example examiner_embed4.py
apply(QMainWindow.__init__, (self,) + args)
with
super(self.__class__, self).__init__()
is not enough to fix this example. [Nevertheless, this example works for me using a previous version of pivy (Debian 7, pivy-0.5.0, PyQt4).]

With the current version of pivy's SoQt-binding (PySide port), there seems to be a type resolution problem with resolving the correct overloaded C++ constructor creating a new instance of SoQtExaminerViewer when attempting to embed it in a PySide widget hierarchy.

  File "C:/pivy-0.6.2/examples/examiner_embed4.py", line 127, in <module>
    main()
  File "C:/pivy-0.6.2/examples/examiner_embed4.py", line 116, in <module>
    vp = EmbeddedWindow()
  File "C:/pivy-0.6.2/examples/examiner_embed4.py", line 93, in <module>
    self.exam = SoQtExaminerViewer(self.examiner)
  File "C:\python-3.6.1.amd64\Lib\site-packages\pivy\gui\soqt.py", line 3200, in __init__
    this = _soqt.new_SoQtExaminerViewer(*args)
builtins.NotImplementedError: Wrong number or type of arguments for overloaded function 'new_SoQtExaminerViewer'.
  Possible C/C++ prototypes are:
    SoQtExaminerViewer::SoQtExaminerViewer(QWidget *,char const *,SbBool,SoQtFullViewer::BuildFlag,SoQtViewer::Type)
    SoQtExaminerViewer::SoQtExaminerViewer(QWidget *,char const *,SbBool,SoQtFullViewer::BuildFlag)
    SoQtExaminerViewer::SoQtExaminerViewer(QWidget *,char const *,SbBool)
    SoQtExaminerViewer::SoQtExaminerViewer(QWidget *,char const *)
    SoQtExaminerViewer::SoQtExaminerViewer(QWidget *)
    SoQtExaminerViewer::SoQtExaminerViewer()

fails to run if qmake is not called "qmake"

Hi,

on Fedora 29 qmake has a suffix to distinguish various versions. In my case it's qmake-qt4.

when setup.py is run it crashes out

  File "/usr/lib64/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
AttributeError: 'NoneType' object has no attribute 'rfind'

It appears that this test for qmake has never been tested on a system where it is NOT present.

The hack for Fedora is to edit the line to look for 'qmake-qt4' but the code should handle this better than crashing out.

example 10.2 not working with soqt

PySide.QtCore.Qevent is not properly wrapped:
<pivy.gui.soqt.QEvent; proxy of <Swig Object of type 'QEvent *' at 0x00000187BBBAA8D0> >

Pivy Python 3.10/3.11 compatibility?

As reported in the FreeCAD forums[1], the guess is that this is a Python compatibility issue...

Excerpt here:

0.19, Dimension013, added view property 'ScaleMultiplier'
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/Draft/draftviewproviders/view_dimension.py", line 701, in onChanged
    self.font.size = vobj.FontSize.Value * vobj.ScaleMultiplier
  File "/usr/lib64/python3.10/site-packages/pivy/coin.py", line 3998, in __setattr__
    field = self.getField(name)
  File "/usr/lib64/python3.10/site-packages/pivy/coin.py", line 3873, in getField
    return _coin.SoFieldContainer_getField(self, name)
<class 'SystemError'>: <built-in function SoFieldContainer_getField> returned a result with an exception set
v0.19, Dimension014, added view property 'ScaleMultiplier'

Fedora 35 has Python 3.10 but future Fedora 36 will have Python 3.11...

pythoin pivy install error

I am using the freecad stable PPA in xubuntu. It use to install and work fine, but recently I started getting an error regarding python-pivy. text styling below is kind of ugly..

what other info can I provide? seems like some example file is corrupt?
./usr/share/doc/python-pivy/examples/Mentor/oak.rgb.gz'

apt --fix-broken install

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libsoqt4-20 python-qt4-gl
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
python-pivy
The following NEW packages will be installed:
python-pivy
0 upgraded, 1 newly installed, 0 to remove and 49 not upgraded.
1 not fully installed or removed.
Need to get 0 B/2,493 kB of archives.
After this operation, 15.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: warning: files list file for package 'libldb1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblightdm-gobject-1-0:amd64' missing; assuming package has no files currently installed
(Reading database ... 527154 files and directories currently installed.)
Preparing to unpack .../python-pivy_0.6.4-0ppa2ubuntu18.04_amd64.deb ...
Unpacking python-pivy (0.6.4-0ppa2
ubuntu18.04) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/python-pivy_0.6.4-0ppa2ubuntu18.04_amd64.deb (--unpack):
cannot copy extracted data for './usr/share/doc/python-pivy/examples/Mentor/oak.rgb.gz' to '/usr/share/doc/python-pivy/examples/Mentor/oak.rgb.gz.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
/var/cache/apt/archives/python-pivy_0.6.4-0ppa2
ubuntu18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Unable to build Debian package

Hi,
As I may have a pivy issue with the version distributed with my OS (SolydK 9), and encouraged by @yorikvanhavre , I tried to build and install it from this repo by building the Debian package but after a couple of trials and errors, I'm stuck with the following error:

~/Sources/pivy/> sudo apt-get install  python-stdeb libsoqt4-dev libcoin80-dev libsimage-dev swig
~/Sources/pivy/> py2dsc pivy-0.6.3.zip
~/Sources/pivy/> cd deb_dist/pivy-0.6.3
~/Sources/pivy/>  l
total 12
drwxr-xr-x  3 tarax tarax 4096 févr. 11 20:18 debian
drwxr-xr-x 13 tarax tarax 4096 janv.  3 23:04 pivy-0.6.3
~/Sources/pivy/deb_dist/pivy-0.6.3> echo "Source: pivy
Maintainer: Tamer Fahmy <[email protected]>
Section: python
Priority: optional
Build-Depends: dh-python, python-all (>= 2.6.6-3), debhelper (>= 9), python-support, python-all-dev, libsoqt4-dev, libcoin80-dev, libsimage-dev, swig
Standards-Version: 3.9.6
Homepage: http://pivy.coin3d.org/

Package: python-pivy
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4-gl
Description: A Python binding for Coin
 Pivy is a Coin binding for Python. Coin is a high-level 3D graphics
 library with a C++ Application Programming Interface. Coin uses
 scene-graph data structures to render real-time graphics suitable for
 mostly all kinds of scientific and engineering visualization
 applications.
 ." > debian/control
~/Sources/pivy/deb_dist/pivy-0.6.3> export PYBUILD_SYSTEM=distutils
~/Sources/pivy/deb_dist/pivy-0.6.3> dpkg-buildpackage -rfakeroot -uc -us
dpkg-buildpackage: info: paquet source pivy
dpkg-buildpackage: info: version source 0.6.3-1
dpkg-buildpackage: info: distribution source unstable
dpkg-buildpackage: info: source changé par Tamer Fahmy <[email protected]>
dpkg-buildpackage: info: architecture hôte amd64
 dpkg-source --before-build pivy-0.6.3
 fakeroot debian/rules clean
dh clean --with python2 --buildsystem=pybuild
   dh_testdir -O--buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:184: python2.7 setup.py clean 
python2.7: can't open file 'setup.py': [Errno 2] No such file or directory
E: pybuild pybuild:283: clean: plugin distutils failed with: exit code=2: python2.7 setup.py clean 
dh_auto_clean: pybuild --clean -i python{version} -p 2.7 returned exit code 13
debian/rules:7 : la recette pour la cible « clean » a échouée
make: *** [clean] Erreur 25
dpkg-buildpackage: erreur: fakeroot debian/rules clean a produit une erreur de sortie de type 2

Problem originaly reported here: https://forum.freecadweb.org/viewtopic.php?f=3&t=26563&p=214825#p214575

Unable to specify additional include flags

David Daish created an issue 2019-03-05

While building Pivy, I needed to be able to specify additional include flags for Swig, but the setup script offered no way to do this. Instead, I had to overwrite the setup script with the required additions.

Specifically, all Swig based builds failed without these flags. -I/usr/include/boost/compatibility/cpp_c_headers -I/usr/include/x86_64-linux-gnu/c++/6/ -I/usr/include/c++/6

To resolve this issue, I recommend adding a command line option for adding additional flags to calls to Swig.

Comments (3)

    Florian Franzen

    I am dealing with this issue too, and it all has to do with the use of swig's -includeall flag (excerpt from the manual):

        It should be noted that your mileage will vary greatly here. System headers are notoriously complicated and may rely upon a variety of non-standard C coding extensions (e.g., such as special directives to GCC). Unless you exactly specify the right include directories and preprocessor symbols, this may not work correctly (you will have to experiment). 

    The project even comes with the required headers in the fake_headers subdirectory but then fails to use them by including standard headers under their C++ name everywhere (e.g. cassert instead of assert.h).

    Currently I would therefore recommend to just drop the current setup.py implementation and to replace it by a scikit-build and CMake based alternative.
        2019-03-06
    Florian Franzen

    Here is how FreeCAD solved the issue.
        2019-03-06
    David Daish reporter

    Interesting. I agree that the setup.py implementation needs a bit of a rewrite. I'm not familiar with this sciki-build system. Seems like a very reasonable way to go. setuputils is notoriously poorly documented.

Example 6.3: no beveled text [includes proposed fix]

Example 6.3 includes several mistakes, however, I'm not sure whether the setValue() calls, e.g. as in

color[0].setValue(1, 1, 1)

and in

coords[0].setValue(0.25, 0.25)

should work Pivy-wise (as in the original C++ and the current Python example). In the current example they insert unexpected values into the scenegraph and the datatype of the elements in the colors list is changed from SbColor to SbVec3f. Anyhow, (otherwise?), I've included a working alternative for this example below. Best wishes, Peter

"""
This is an example from the Inventor Mentor,
chapter 6, example 3.

This example renders arguments as text within an
ExaminerViewer.  It is a little fancier than 6.2.
"""

import sys

from PySide.QtGui import *
from pivy.coin import *
from pivy.quarter import *

def main():
    # Initialize Inventor and Qt
    app = QApplication(sys.argv)
    viewer = QuarterWidget()

    root = SoGroup()

    # Set up camera
    myCamera = SoPerspectiveCamera()
    myCamera.position = (0, -(len(sys.argv) - 1) / 2, 10)
    myCamera.nearDistance = 5.0
    myCamera.farDistance = 15.0
    root += myCamera

    # Let's make the front of the text white,
    # and the sides and back shiny yellow
    myMaterial = SoMaterial()
    # diffuse
    colors = [SbColor()] * 3
    colors[0] = SbColor(1, 1, 1)
    colors[1] = SbColor(1, 1, 0)
    colors[2] = SbColor(1, 1, 0)
    myMaterial.diffuseColor.setValues(0, 3, colors)

    # specular
    colors[0].setValue(1, 1, 1)
    """
    # Note: Inventor 2.1 doesn't support multiple specular colors.
    # colors[1].setValue(1, 1, 0)
    # colors[2].setValue(1, 1, 0)
    # myMaterial.specularColor.setValues(0, 3, colors)
    """
    myMaterial.specularColor.setValue(colors[0])
    myMaterial.shininess.setValue(.1)
    root += myMaterial

    # Choose a font likely to exist.
    myFont = SoFont()
    myFont.name = "Times" # "Times-Roman"
    root += myFont

    # Specify a beveled cross-section for the text
    myProfileCoords = SoProfileCoordinate2()
    coords = [SbVec2f()] * 4
    coords[0] = SbVec2f(.00, .00)
    coords[1] = SbVec2f(.25, .25)
    coords[2] = SbVec2f(1.25, .25)
    coords[3] = SbVec2f(1.50, .00)
    myProfileCoords.point.setValues(0, 4, coords)
    root += myProfileCoords

    myLinearProfile = SoLinearProfile()
    index = (0, 1, 2, 3)
    myLinearProfile.index.setValues(0, 4, index)
    root += myLinearProfile

    # Set the material binding to PER_PART
    myMaterialBinding = SoMaterialBinding()
    myMaterialBinding.value = SoMaterialBinding.PER_PART
    root += myMaterialBinding

    # Add the text
    myText3 = SoText3()
    myText3.string = "Beveled Text"
    myText3.justification = SoText3.CENTER
    myText3.parts = SoText3.ALL

    root += myText3
	
    viewer.setSceneGraph(root)
    viewer.setWindowTitle("Complex 3D Text")
    viewer.show()
    viewer.viewAll()

    sys.exit(app.exec_())

if __name__ == "__main__":
    main()

Why not using cmake for everything?

Is there any special reason to use distutils (in which you partially use cmake to retrieve soqt and coind paths) instead of cmake for everything?

Your setup.py doesn't take care of lots of corner case (for example on macOS where qmake is not available in the PATH if installed with Macports) and it assumes a standard configuration that is not really standard for most users. Using cmake would standardize most of the stuff that now is hacked in the setup.pyand partially buggy...

Create release?

Richard Shaw created an issue 2019-09-05

I maintain FreeCAD for Fedora linux and currently we are using a checkout of Pivy but it is preferred to work from releases. Would it be possible to tag a release?

Comments (1)

    Bastiaan Veelo

    Hi Richard,

    For Pivy I think that is unproblematic; I assume none of the current two other open issues are a problem for you? However you likely also would like a release of Coin itself, am I right? That may need more cooperation. We are working on migration to Github, and I think a release prior to that makes sense anyway. What is your time schedule?

    Bastiaan.

problem of mentor example 10.1

Hi, I am new to openiv and find your pivy lib very useful. I install pivy from the FreeCAD ppa of Ubuntu. When I try to run the mentor example 10.1.addEventCB.py, I find it does not work. I cannot be pick the object if the scene is static. And if I pick an object and press the up arrow key, python will automatically exit, with:
*** Error in `python': free(): invalid pointer: 0x000000000300cfd8 ***.
I don't know if I miss something or it is a bug. Thank you.

trouble with pivy compilation

Hello guys!
I posted a question about the problem in google groups.
But no one replied, could you please suggest how do I fix this issue ?

Problem: I compiled soqt from latest source code on github.
And now i need to compile pivy
When I try to compile on gentoo latest version of pivy from github repository, I am getting following problem:

interfaces/pivy_common_typemaps.i:473: Error: Unable to find 'Inventor/events/SoEvent.h'
Inventor/SoType.h:40: Error: Unable to find 'Inventor/SbBasic.h'
Inventor/SbDict.h:54: Error: Unable to find 'Inventor/SbBasic.h'
Inventor/fields/SoField.h:41: Error: Unable to find 'Inventor/misc/SoNotification.h'
Inventor/fields/SoField.h:212: Error: Unable to find 'Inventor/fields/SoSField.h'
Inventor/SbString.h:43: Error: Unable to find 'Inventor/system/inttypes.h'
Inventor/lists/SbPList.h:40: Error: Unable to find 'Inventor/SbBasic.h'
Inventor/SbName.h:40: Error: Unable to find 'Inventor/SbBasic.h'
interfaces/coin_header_includes.h:1: Error: Unable to find 'Inventor/actions/SoAction.h'
interfaces/coin_header_includes.h:2: Error: Unable to find 'Inventor/actions/SoActions.h'
interfaces/coin_header_includes.h:3: Error: Unable to find 'Inventor/actions/SoAudioRenderAction.h'
interfaces/coin_header_includes.h:4: Error: Unable to find 'Inventor/actions/SoBoxHighlightRenderAction.h'
Inventor/actions/SoCallbackAction.h:42: Error: Unable to find 'Inventor/actions/SoAction.h'
Inventor/actions/SoCallbackAction.h:43: Error: Unable to find 'Inventor/actions/SoSubAction.h'
Inventor/actions/SoCallbackAction.h:44: Error: Unable to find 'Inventor/elements/SoDecimationTypeElement.h'
Inventor/actions/SoCallbackAction.h:45: Error: Unable to find 'Inventor/lists/SbList.h'
..............


here is my cmake info:

Python version...3.6.10
Checking for swig...
'/usr/bin/swig'
Checking for SWIG version...
4.0.0
calling: cmake
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- COIN_FOUND: true
-- COIN_INCLUDE_DIR: /usr/include/Coin4
-- COIN_LIB_DIR: /usr/lib64
-- COIN_VERSION: 4.0.0
-- SOQT_FOUND: true
-- SOQT_INCLUDE_DIR: /usr/include;/usr/include
-- SOQT_LIB_DIR: /usr/lib64
-- SOQT_VERSION: 1.6.0
-- Configuring done
-- Generating done
-- Build files have been written to: /var/tmp/portage/dev-python/pivy-9999/work/pivy-9999

checking for COIN via cmake

COIN_FOUND: true

COIN_VERSION: 4.0.0

COIN_INCLUDE_DIR: /usr/include/Coin4

COIN_LIB_DIR: /usr/lib64



checking for SOQT via cmake

SOQT_FOUND: true

SOQT_VERSION: 1.6.0

SOQT_INCLUDE_DIR: /usr/include" -I"/usr/include

SOQT_LIB_DIR: /usr/lib64



coin-features are not supported in this version

Preparing Inventor headers: Inventor/SbTime.h Inventor/SbImage.h Inventor/SbDPRotation.h Inventor/SoFullPath.h Inventor/SbString.h Inventor/SbVec3f.h Inventor/SbDict.h Inventor/SbRotation.h Inventor/SbDPPlane.h Inventor/SbBox2f.h Inventor/SoType.h Inventor/SbViewportRegi
on.h Inventor/SbVec4d.h Inventor/SbBox2s.h Inventor/SbVec2d.h Inventor/SbVec2f.h Inventor/SbName.h Inventor/SoOffscreenRenderer.h Inventor/SoPath.h Inventor/SoNodeKitPath.h Inventor/SbBox2d.h Inventor/SbViewVolume.h Inventor/SbColor4f.h Inventor/SbPlane.h Inventor/SbVec2
s.h Inventor/SbVec3s.h Inventor/SoInput.h Inventor/SoRenderManager.h Inventor/SbMatrix.h Inventor/SoSceneManager.h Inventor/SbBox3s.h Inventor/SbVec4f.h Inventor/SbColor.h Inventor/SbBox3f.h Inventor/SbXfBox3f.h Inventor/SbVec3d.h Inventor/SbDPMatrix.h Inventor/misc/SoBa
se.h Inventor/scxml/ScXMLStateMachine.h Inventor/actions/SoGLRenderAction.h Inventor/actions/SoCallbackAction.h Inventor/nodes/SoMarkerSet.h Inventor/nodes/SoEventCallback.h Inventor/nodes/SoGroup.h Inventor/nodes/SoSelection.h Inventor/nodes/SoCallback.h Inventor/nodeki
ts/SoBaseKit.h Inventor/elements/SoLazyElement.h Inventor/elements/SoDiffuseColorElement.h Inventor/lists/SoTypeList.h Inventor/lists/SoPickedPointList.h Inventor/lists/SoEngineOutputList.h Inventor/lists/SoFieldList.h Inventor/lists/SbVec3fList.h Inventor/lists/SoNodeLi
st.h Inventor/lists/SbIntList.h Inventor/lists/SbPList.h Inventor/lists/SoPathList.h Inventor/lists/SoBaseList.h Inventor/lists/SoDetailList.h Inventor/lists/SoActionMethodList.h Inventor/lists/SoEngineList.h Inventor/lists/SbStringList.h Inventor/engines/SoEngine.h Inve
ntor/draggers/SoDragger.h Inventor/sensors/SoTimerQueueSensor.h Inventor/sensors/SoPathSensor.h Inventor/sensors/SoFieldSensor.h Inventor/sensors/SoDelayQueueSensor.h Inventor/sensors/SoSensor.h Inventor/sensors/SoOneShotSensor.h Inventor/sensors/SoAlarmSensor.h Inventor
/sensors/SoDataSensor.h Inventor/sensors/SoSensorManager.h Inventor/sensors/SoIdleSensor.h Inventor/sensors/SoNodeSensor.h Inventor/sensors/SoTimerSensor.h Inventor/fields/SoMField.h Inventor/fields/SoMFShort.h Inventor/fields/SoSFShort.h Inventor/fields/SoMFBool.h Inven
tor/fields/SoSFUInt32.h Inventor/fields/SoSFPath.h Inventor/fields/SoMFName.h Inventor/fields/SoFieldContainer.h Inventor/fields/SoMFVec2f.h Inventor/fields/SoMFTime.h Inventor/fields/SoMFUShort.h Inventor/fields/SoMFString.h Inventor/fields/SoSFRotation.h Inventor/field
s/SoMFPlane.h Inventor/fields/SoMFVec3f.h Inventor/fields/SoSFVec2f.h Inventor/fields/SoMFRotation.h Inventor/fields/SoSFEnum.h Inventor/fields/SoSFMatrix.h Inventor/fields/SoMFMatrix.h Inventor/fields/SoField.h Inventor/fields/SoMFColor.h Inventor/fields/SoMFPath.h Inve
ntor/fields/SoSFFloat.h Inventor/fields/SoSFImage.h Inventor/fields/SoMFInt32.h Inventor/fields/SoSFString.h Inventor/fields/SoSFEngine.h Inventor/fields/SoSFPlane.h Inventor/fields/SoSFNode.h Inventor/fields/SoSFVec3f.h Inventor/fields/SoSFTime.h Inventor/fields/SoSFBoo
l.h Inventor/fields/SoMFVec4f.h Inventor/fields/SoMFUInt32.h Inventor/fields/SoMFFloat.h Inventor/fields/SoSFTrigger.h Inventor/fields/SoSFImage3.h Inventor/fields/SoSFVec4f.h Inventor/fields/SoSFInt32.h Inventor/fields/SoSFUShort.h Inventor/fields/SoMFEngine.h Inventor/
fields/SoMFNode.h Inventor/fields/SoMFEnum.h Inventor/fields/SoSFColor.h Inventor/fields/SoSFName.h Inventor/fields/SoMFVec3d.h Inventor/collision/SoIntersectionDetectionAction.h.

and then following error:

=== Generating pivy/gui/soqt_wrap.cpp for soqt ===
 
swig -w302,306,307,312,314,325,361,362,467,389,503,509,510 -py3 -c++ -python -includeall -modern -D__PIVY__ -I. -Ifake_headers -I"/usr/include" -I"/usr/include" -Iinterfaces  -o pivy/gui/soqt_wrap.cpp interfaces/soqt.i
SWIG did not generate wrappers successfully! ** Aborting **
 ^[[31;01m*^[[0m ERROR: dev-python/pivy-9999::local failed (compile phase):

TODO: py3/qt5

  • there are soqt libraries available which build with qt5. Pivy needs a soqt-config, which isn't generated with cmake.
  • the bitbucket soqt version has some problems with cmake. My older version works with cond (linux) https://github.com/looooo/soqt. Find the relevant stuff and make PR for soqt
  • pivy needs to be updated to pyside2. It's allready possible to build the library, but soqt/quarter won't work yet. Quarter should be simple as it's all on python level. SoQT is hopefully also not to hard to port, as the used PySide stuff is not very much.

Unify Coin3D & FreeCAD pivy repos

The Coin3D organization's migration to GitHub is now basically complete, and pivy is now maintained with git: https://github.com/coin3d/pivy

Therefore we should aim to upstream changes in FreeCAD's pivy repo and move maintenance from this fork to there.

I've already upstreamed the patches used in the Debian package and made a 0.6.5 release. I'm working on getting CI fixed as well.

+= isn't consistent

make += on subclasses of group work equal to a python list

problem: += a SoGroup will lead to a flat representation of this group as this group is can be iterated.

Check if object is subclass og SoGroup, if it is: add to node. else iterate and add each element.

unable to open file "...\Coin3D\lib\Coin4.lib"

when building with "python setup.py build" by cmd in Windows 10, it always shows
LINK : fatal error LNK1104: unable to open file “"E:\Coin3D\Coin3D\lib\Coin4.lib"”
My Coin version is coin-4.0.0-msvc15-x64 and pivy version is 0.6.6 (0.6.4 also wrong).
Can you help me on this problem?

Update metadata

pivy/setup.py

Line 675 in 65c72af

download_url="http://pivy.coin3d.org/download/",

the website doesn't exist anymore, please use this github page if there's no other option

Pivy's QuarterWidget: Not properly handled (or missed) mouse click events in examples 13.4 and 13.5

Issue found and test cases:
Running example 13.4.Gate.py, clicking the left mouse button repeatedly is expected to toggle duck motion, howevever, often in a quick sequence of left mouse clicks they do not get handled / are being missed / have no visual effect. (However, there do not seem to be any missed mouse clicks when alternating between clicking the left and right mouse button in these python examples.) The same issue also could be produced with example 13.5.Boolean.py as a second test case. Running the corresponding native C++ examples 13.4 and 13.5, however, I was unable to produce this issue. Therefore, I reckon the issue is with Pivy.

Test environments where this issue was found:

  • 32-bit Debian 7, default packages: Python 2.7.3, Coin3D 3.1.3, Pivy 0.5.0
  • 64-bit Windows 10, 64-bit Python 3.6.1, Coin3D 4.0.0a, Pivy 0.6.0

Maybe you can produce and confirm this issue in your environment, too. Many thanks!

Detecting abnormal qmake install locations

David Daish created an issue 2019-02-14

When running setup.py build, the script fails with a somewhat unhelpful error message, if distutils.spawn.find_executable() cannot find the qmake executable:

root@9e855bfad5db:/tmp/pivy# python3 setup.py build 
Traceback (most recent call last):
  File "setup.py", line 96, in <module>
    class pivy_build(build):
  File "setup.py", line 168, in pivy_build
    QTINFO = qtinfo.QtInfo()
  File "/tmp/pivy/qtinfo.py", line 14, in __init__
    getattr(self, thing)
  File "/tmp/pivy/qtinfo.py", line 32, in getLibsExecsPath
    return self.getProperty("QT_INSTALL_LIBEXECS")
  File "/tmp/pivy/qtinfo.py", line 68, in getProperty
    self._dict[prop_name] = self._getProperty(prop_name)
  File "/tmp/pivy/qtinfo.py", line 57, in _getProperty
    proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, shell=False)
  File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1205, in _execute_child
    executable = os.fsencode(executable)
  File "/usr/lib/python3.5/os.py", line 862, in fsencode
    raise TypeError("expect bytes or str, not %s" % type(filename).__name__)
TypeError: expect bytes or str, not NoneType

This is solved if you instantiate QtInfo with the qmake_command named argument, like this:

qtinfo.QtInfo(qmake_command=["/usr/local/Qt-5.12.2/bin/qmake"])

However, the setup.py script offers no way to do this from the command line. You have to edit the file itself, which is annoying when installing pivy from a script.

As an alternative, I recommend offering the ability to add a command line argument, along the lines of:

python3 setup.py install --qmake_path /usr/local/Qt/bin/qmake

Comments (2)

    David Daish reporter

    Also, this was discovered on tag 0.6.4
        2019-02-14
    Florian Franzen

    If qmake can be found on your current PATH, it should be detected correctly automatically.

0.6.5a1: windows failing

https://ci.appveyor.com/project/conda-forge/pivy-feedstock/builds/24469708/job/7k7no2jbe3d5cw5t

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I%PREFIX%\include -I%PREFIX%\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" -I%PREFIX%\Library\include -I%PREFIX%\Library\include /EHsc /Tppivy\coin_wrap.cpp /Fobuild\temp.win-amd64-3.6\Release\pivy\coin_wrap.obj -Iinterfaces -IC:/bld/pivy_1557563866252/_h_env/Library/include -IC:/bld/pivy_1557563866252/_h_env/Library/include\Inventor\annex -Wno-unused -Wno-maybe-uninitialized
cl : Command line error D8021 : invalid numeric argument '/Wno-unused'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2

reason (maybe): windows needs quotes for include directories!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.