Workspace/Node definition copy method usefull!?

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Workspace/Node definition copy method usefull!?

Post by al2950 »

I have a whole set of node definitions and workspace definitions, but I want to alter them slightly based on user settings or VR setup. The problem is definitions are referenced from instantiations and so if you change a definition it will change the behavior of every workspace its used in.

So to that end has anyone else come up against this issue, and do you think a 'definition' copy method would be helpful?

I could, and do, just setup workspaces in code, but I really like using the scripts as a form of templates and/or building blocks.
zxz
Gremlin
Posts: 184
Joined: Sat Apr 16, 2016 9:25 pm
x 19

Re: Workspace/Node definition copy method usefull!?

Post by zxz »

I also wanted some sort of copy functionality when setting up compositor workspaces dynamically. We have a multitude of views that are fully configurable during runtime, which requires a lot of programmatically generated nodes and workspaces. The scripts are handy for quick tests, but are less useful in the final product, where they need to be fully recreated in code for parameterization.

In general I find the compositor API somewhat unwieldy when not using the scripts. A lot of the code ends up being for handling the ownership and lifetime of CompositorNodeDefs, CompositorShadowNodeDefs, CompositorWorkspaceDefs and CompositorWorkspaces. It would be handy if the definitions were more value-like and easily copyable.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Workspace/Node definition copy method usefull!?

Post by al2950 »

Glad its not just me :D

It would be fairly easy to implement. The only barrier is that the CompositorPassDef's would require a virtual clone method, hence posting here.

**EDIT** infact in my opinion a definition should be copied when its used to create an instance, the definitions in a instantiation should not be references
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Workspace/Node definition copy method usefull!?

Post by al2950 »

I am back on this, this time I want to change the visibility mask per instance of the compositor. And dont want to have to specify a different compositor for every instance, I just want to change the visibility mask at runtime in code.

Any more thoughts on this?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Workspace/Node definition copy method usefull!?

Post by dark_sylinc »

Hi!

Changes are welcomed. You're making good points that the compositor API, at least in its current state, needs a higher level API on top of it to make it user friendly.

When it comes to cloning code, can I suggest the approach taken by datablocks? The actual copy implementation is written by Other/clone_datablock/run.py which generates Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp.inc and Components/Hlms/Unlit/src/OgreHlmsUnlitDatablock.cpp.inc

This allows us to automate the clone implementation, eliminating human error and allowing the clone implementation to always be up to date even if its struct definition changes.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Workspace/Node definition copy method usefull!?

Post by al2950 »

dark_sylinc wrote: Fri Aug 23, 2019 3:42 pm When it comes to cloning code, can I suggest the approach taken by datablocks?
Yup, I was already thinking that. I use python clang a lot for auto generating C and C# apis from my C++ component code :D

I have a 12hr flight coming up so may work on this then, although was sort of hoping to get back to my GPU particles code
Post Reply