Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address conflict between visualization and VTK head #2612

Merged
merged 4 commits into from Nov 21, 2018
Merged

address conflict between visualization and VTK head #2612

merged 4 commits into from Nov 21, 2018

Conversation

greenbrettmichael
Copy link
Contributor

@greenbrettmichael greenbrettmichael commented Nov 11, 2018

error in vtk/rendering/core introduced by Kitware/VTK@bbc96ed

Closes #2623

@greenbrettmichael
Copy link
Contributor Author

appveyor appears to have timed out during the build process

@taketwo
Copy link
Member

taketwo commented Nov 12, 2018

Hi, the lines that you are changing have quite a history, please refer to #2291, #2311, and #2322. As you can see, we have been bouncing between different version checks for a while. I would like to avoid a situation that we merge a commit that fixes the problem for you, but breaks builds for others. Please check especially the last thread that I referenced. We need to know a specific released VTK version where the API changed.

@marcel-bariou
Copy link

marcel-bariou commented Nov 18, 2018

@taketwo @SergioRAgostinho ...Hi, the lines that you are changing have quite a history, please refer to #2291, #2311, and #2322. As you can see, we have been bouncing between different version checks for a while ....

Ubuntu 18.04 LTS
GCC 4.3 VTK 8.2 with PCL 1.9+ Latest commit 9073f63 2018/11/14
I pickup the 2612 change #ii..#else ..#endif, after code line 3563 and I apply it to the previous commit, it works perfectly thanks ! :

 #if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2
     mapper->MapDataArrayToMultiTextureAttribute(mesh.tex_materials[tex_id].tex_name.c_str(),
       this_coordinates_name.c_str(),
       vtkDataObject::FIELD_ASSOCIATION_POINTS);
 #else
     mapper->MapDataArrayToMultiTextureAttribute(tu,
                                                 this_coordinates_name.c_str (),
                                                 vtkDataObject::FIELD_ASSOCIATION_POINTS);
     this_coordinates_name.c_str(),
     vtkDataObject::FIELD_ASSOCIATION_POINTS);
 #endif    

    polydata->GetPointData ()->AddArray (coordinates);
    actor->GetProperty ()->SetTexture (tu, texture);
    ++tex_id;
  }

Maintainer edit: aesthetics

@greenbrettmichael
Copy link
Contributor Author

@taketwo

the API changes mapper->MapDataArrayToMultiTextureAttribute to take a string, whereas SetTexture remains an integer. This prevents the approach given by the previous define from working. This was changed on VTK commit Kitware/VTK@bbc96ed 10 months ago.

This change is encorporated into the upcoming release https://blog.kitware.com/vtk-8-2-0-rc1-ready-for-testing/ . The previous define would have never activated as VTK has not release a version 9, so this change is safe from breaking users with previous versions.

@taketwo
Copy link
Member

taketwo commented Nov 20, 2018

Thanks for investigating. I just have a minor suggestion then, can we keep the #if/#else stuff at the same place as it is now, only update the version check:

#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 2) || VTK_MAJOR_VERSION > 8
  const char *tu = mesh.tex_materials[tex_id].tex_name.c_str ();
#else
  int tu = vtkProperty::VTK_TEXTURE_UNIT_0 + tex_id;
#endif

@marcel-bariou
Copy link

marcel-bariou commented Nov 20, 2018 via email

@taketwo taketwo mentioned this pull request Nov 20, 2018
16 tasks
@SergioRAgostinho SergioRAgostinho added this to the pcl-1.9.1 milestone Nov 20, 2018
@greenbrettmichael
Copy link
Contributor Author

@taketwo I agree that is more aesthetically pleasing and nicer to the commit history. However line 3570 requires int tu in all VTK versions
actor->GetProperty ()->SetTexture (tu, texture);
As a compromise, how about:

#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 2) || VTK_MAJOR_VERSION > 8
  const char *tu = mesh.tex_materials[tex_id].tex_name.c_str ();
#else
  int tu = vtkProperty::VTK_TEXTURE_UNIT_0 + tex_id;
#endif
int tuID = vtkProperty::VTK_TEXTURE_UNIT_0 + tex_id;
...
mapper->MapDataArrayToMultiTextureAttribute(tu,
  this_coordinates_name.c_str(),
  vtkDataObject::FIELD_ASSOCIATION_POINTS);
polydata->GetPointData ()->AddArray (coordinates);
actor->GetProperty ()->SetTexture (tuID, texture);

I hope that I am not coming off as a pedant, I have more contributions to make!

@taketwo
Copy link
Member

taketwo commented Nov 20, 2018

Maybe I'm checking in the wrong place, but I see the following signature:

void vtkProperty::SetTexture(const char* name, vtkTexture* tex)

Edit: the commit you referred to earlier has decorated the int signature with VTK_LEGACY.

@greenbrettmichael
Copy link
Contributor Author

@taketwo I concede that I was mistaken. I have pushed the requested change. This builds for me

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@SergioRAgostinho SergioRAgostinho merged commit ce08586 into PointCloudLibrary:master Nov 21, 2018
@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Nov 21, 2018

Thanks everyone.

Edit: I just noticed I merged again instead of squashing...

@greenbrettmichael greenbrettmichael deleted the vtk_patch branch November 25, 2018 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants