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

Leftovers from #10767 #10785

Open
luzpaz opened this issue Sep 23, 2023 · 7 comments
Open

Leftovers from #10767 #10785

luzpaz opened this issue Sep 23, 2023 · 7 comments
Assignees
Labels
Refactor PRs that only refactor code WB Assembly Related to the Integrated Assembly Workbench

Comments

@luzpaz
Copy link
Contributor

luzpaz commented Sep 23, 2023

Originally posted by @wwmayer in #10767 (comment)

Some remarks:

  • In order to avoid possible problems with scripting you should consider moving the view provider code into a separate file
  • In the view provider you shouldn't add a callback function that is linked to the camera of the active view because this is error prone. If you open a new 3D view from the View menu then auto-scaling doesn't work.

Instead you should use the class SoShapeScale:

from pivy import coin

cube = coin.SoCube()

type = coin.SoType.fromName("SoShapeScale")
scale = type.createInstance()
scale.setPart("shape", cube)

graph = Gui.ActiveDocument.ActiveView.getSceneGraph()
graph.addChild(scale)
scale.scaleFactor = 10

CC @qewer33

@luzpaz luzpaz added WB Assembly Related to the Integrated Assembly Workbench Refactor PRs that only refactor code labels Sep 23, 2023
@qewer33
Copy link
Contributor

qewer33 commented Sep 23, 2023

@wwmayer I can't find any documentation about SoShapeScale. Seems like it's a FreeCAD class and not an OpenInventor/Coin3D one? What differences does it have compared to SoScale? Does it auto scale shapes according to the view?

Also I took the view scaling approach from the transform dragger's source (it also works with the SoFieldSensor callback way), might make sense to also refactor that if SoShapeScale is better.

@wwmayer
Copy link
Contributor

wwmayer commented Sep 24, 2023

I can't find any documentation about SoShapeScale. Seems like it's a FreeCAD class and not an OpenInventor/Coin3D one?

Originally, it was developed by the makers of Coin3D but it's not an official OpenInventor class.

Does it auto scale shapes according to the view?

Yes, that's what it does. It's all done internally and you don't have to bother with the zooming.

Also I took the view scaling approach from the transform dragger's source (it also works with the SoFieldSensor callback way), might make sense to also refactor that if SoShapeScale is better.

It works as expected because when setting the view provider in edit mode it receives the currently active 3D viewer. Only in this viewer you see the draggers but not in any other 3D viewer that belongs to the document.

@luzpaz
Copy link
Contributor Author

luzpaz commented Oct 11, 2023

bump @qewer33 for status

@luzpaz
Copy link
Contributor Author

luzpaz commented Oct 23, 2023

@qewer33 ping

@qewer33
Copy link
Contributor

qewer33 commented Oct 26, 2023

I was busy the last few weeks, will handle this this weekend hopefully

@PaddleStroke
Copy link
Contributor

@qewer33 was this solved ? It was concerning the JCS objects ?

@qewer33
Copy link
Contributor

qewer33 commented May 15, 2024

@PaddleStroke nope I haven't worked on it. It is regarding JCS objects (and also technically any other Coin object that autoscales like the transform dragger)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor PRs that only refactor code WB Assembly Related to the Integrated Assembly Workbench
Projects
None yet
Development

No branches or pull requests

4 participants