Skip to content

Proposed Node refactoring #728

@m3d

Description

@m3d

It is not obvious that osgar.node:Node automatically fills variables received by self.listen() (for example self.scan when it receives scan). I would propose to add new function register_variables('scan', 'pose3d'), which would automatically define self.scan and self.pose3d, and initialize them to None.

Open question is what to do with self.time, i.e. does it have to be also specified in call register_variables()?

What to do with variables, which are not listed? I would recommend to ignore and not set them.


The second proposed change is to modify Node.update() and extend it to

        handler = getattr(self, "on_" + channel, None)
        if handler is not None:
            handler(getattr(self, channel))

I am using this construct in almost every class.

Note, that this refactoring influences ALL usages of Node including external projects, so I would like agreement before I start it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions