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

Needs some methods to define node for templating node structure feature #435

Open
kyasbal opened this issue Jan 29, 2017 · 3 comments
Open

Comments

@kyasbal
Copy link
Member

kyasbal commented Jan 29, 2017

Sometimes, we needs to define some node structure like Prefab in unity

@kyasbal
Copy link
Member Author

kyasbal commented Feb 14, 2017

Basically, current node system is like Prefab non containing children. It means node system is already has such feature.
If the node can be defined with children, it seems Prefab basically.

So, this is suggestion of feature.

gr.registerNode("aaa",[COMPONENTS...],{ default values...},[ child structure],"base-node-name");

For consistency, 4th argument should be able to receive string as base node name also.
The most important thing in this suggestion is child structure part.

This shall contain some nodes like below.

["bbb","ccc","ddd"]

The declared node aaa should have 3 nodes(bbb,ccc and ddd) as children by default.

`[["bbb",{default values}],"ccc"]

The declared node aaa should have 2 nodes(bbb and ccc) as children by default.
And the node bbb have default values to override default value of node bbb.

Therefore, order of priority should be rewritten as below.

User specified value > (Prefab specified value) > default value on node > Default value on component

@moajo
Copy link
Contributor

moajo commented Jun 16, 2017

I think this notation will break the consistency of node system.
When using such nodes in GOML, how do you notate their child nodes?
I think that the notation of GOML does not match the structure of the tree.
Furthermore, it seems that it is not possible to modify attributes of defined child nodes from GOML.

I think that this function should be implemented on the existing node and component framework.

so, I propose template node and Template component instead.

template node

Definition

gr.registerNode("template",[TemplateComponent]);

Usage

<template goml="template.goml" autoResolve="true"/>

Template Component replace this node by template.goml.
if autoResolve is true, resolve template automaticaly when on awake or mount or any other timing.

Template Component

var tmp = gr("*")("template").first().getComponent("Template");

// template from GOML
tmp.setAttribute("goml",goml_data);

// clone other node tree structure.
tmp.clone(gr("*")("#template_target").firsst());

//execute parsing template and replace this node manually.
tmp.resolve();

@kyasbal
Copy link
Member Author

kyasbal commented Sep 14, 2017

その他の属性はルートに付与

@moajo moajo mentioned this issue Sep 15, 2017
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants