Workspace/Node definition copy method usefull!?

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Workspace/Node definition copy method usefull!?

Post by al2950 » Mon Sep 04, 2017 4:34 pm

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.
0 x

zxz
Greenskin
Posts: 141
Joined: Sat Apr 16, 2016 9:25 pm
x 5

Re: Workspace/Node definition copy method usefull!?

Post by zxz » Mon Sep 04, 2017 8:50 pm

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.
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: Workspace/Node definition copy method usefull!?

Post by al2950 » Mon Sep 04, 2017 9:12 pm

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
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: Workspace/Node definition copy method usefull!?

Post by al2950 » Fri Aug 23, 2019 10:15 am

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?
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4066
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: Workspace/Node definition copy method usefull!?

Post by dark_sylinc » Fri Aug 23, 2019 3:42 pm

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.
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: Workspace/Node definition copy method usefull!?

Post by al2950 » Fri Aug 23, 2019 3:50 pm

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
0 x

Post Reply