Closed ZacZhangzhuo closed 2 months ago
@gonzalocasas or @tomvanmele anything keeping you back from merging? cool contribution @ZacZhangzhuo
@gonzalocasas or @tomvanmele anything keeping you back from merging? cool contribution @ZacZhangzhuo
thanks for the poke!
@gonzalocasas or @tomvanmele anything keeping you back from merging? cool contribution @ZacZhangzhuo
thanks! :-)
I think we are good to go @gonzalocasas
the build still failed even with:
@plugin(category="factories", requires=["compas_viewer"])
def register_scene_objects():
from .robotmodelobject import RobotModelObject
register(RobotModel, RobotModelObject, context="Viewer")
@gonzalocasas
Sorry, I just realized that something is off. And it's that we don't need to have the viewer plugin inside compas_robots
, that's exactly why these things are plugins, so that this module can live inside the repo of compas_viewer
and be auto-discovered
Sorry, I just realized that something is off. And it's that we don't need to have the viewer plugin inside
compas_robots
, that's exactly why these things are plugins, so that this module can live inside the repo ofcompas_viewer
and be auto-discovered
didn't really get it. How should we modify the code then? i created this init.py based on src\compas_robots\rhino\scene\__init__.py
, as a template.
Sorry, I just realized that something is off. And it's that we don't need to have the viewer plugin inside
compas_robots
, that's exactly why these things are plugins, so that this module can live inside the repo ofcompas_viewer
and be auto-discovereddidn't really get it. How should we modify the code then? i created this init.py based on
src\compas_robots\rhino\scene\__init__.py
, as a template.
The code is all correct, but I think it just needs to be moved to the compas_viewer
project instead of here.
@gonzalocasas is it not exactly the other way around?! since it is a plugin system, not everything needs to be implemented in the viewer (since the viewer can't know about all the packages that want to plug into it), but rather in the packages themselves? Rhino scene objects are also implemented per package and not all in compas_rhino
, for the same reason. the viewer "auto discovers" all implementations of viewer scene object implementations across packages...
Alright, this one was really confusing to reason about. I thought about it a bunch, then discussed it also with @yck011522.
So, in terms of dependencies, this is correct. The plugin part takes care of decoupling the dependency from compas_robots
to compas_viewer
, and at the same time, if the interface on the viewer side is correct, viewer should not be dependent on compas_robots
either. So that's all good.
In this diagram (directed dashed line represents a "A depends on B" relationship), it's highlighted how the sub-packages of this repository that deal with each CAD/viewer have dependencies on those things (Blender, Viewer and Rhino respectively), and also have a dependency on the RobotModel
class of compas_robots
:
My confusion came from the fact of what does a developer of different parts of the system need to be aware of when developing:
compas_viewer
now needs to be aware that there are features that depend on the viewer that are spread across multiple repositories,compas_robots
will immediately be aware that changes to the RobotModel
class need to be propagated to all the implementations of scene objects, and it will all be in this repository.We don't have this problem so clear in the case of Rhino/Blender, because those code bases are external to us, and none of us develops Rhino or Blender themselves, but viewer is a bit of a different case.
And here there's a bit of an assumption, but I expect the API of compas_robots
and its RobotModel
class to change more often than the base API that compas_viewer
requires for it to be able to support a new object type, so, in that case, it makes sense that this stays in this repository.
Bottom line: we keep it here. The only thing remaining is to fix the build.
This one has been replaced by https://github.com/compas-dev/compas_robots/pull/14
see https://github.com/compas-dev/compas_viewer/pull/74
Major Changes
RobotModelObject
and its example in the documentation. theRobotModelObject
class is the main focus of this PR.Test
Example file can be found at : https://compas.dev/compas_viewer/latest/examples/object/robot.html