Git Product home page Git Product logo

Comments (6)

sassembla avatar sassembla commented on July 19, 2024
  • functions of filters

Yes, Filter node’s GUI function is very limited.
You can define your own Filter node.(not yet documented, but plan is exists.)

sample code is below.

https://github.com/unity3d-jp/AssetGraph/blob/master/Assets/AssetGraph/UserSpace/Examples/Editor/FilterAllResources.cs

AssetGraph aims to supply easy way for controlling Assets by default.
And, supply customizable nodes for complex usage.

  • no way to implement inspectors

Yes,,, Around the Inspector it is very complex .
(Undo, Graph’s DataBinding, and Designing GUI.)

There is no plan about this.

・implement a node which adds components to a prefab built by prefabricator

How about this?

// This code is arrange of CreateCharaPrefab.cs https://github.com/unity3d-jp/AssetGraph/blob/master/Assets/AssetGraph/UserSpace/Examples/Editor/CreateCharaPrefab.cs

public class CreateCharaPrefab2 : AssetGraph.PrefabricatorBase {
    public override void In (string groupKey, List<AssetGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<GameObject, string, bool, string> Prefabricate) {

            // ... omitted ... //

            // for example, instantiate model.
        var modelObj = GameObject.Instantiate(charaModel);

            // add component to it.
            modelObj.AddComponent<Rigidbody>();

            // then Prefabricate(object, string, bool) method makes prefab for it.
        var prefabName = groupKey + "_chara.prefab";
        var prefabOutputPath = Prefabricate(modelObj, prefabName, false);

        // delete unnecessary chara model from hierarchy.
        GameObject.DestroyImmediate(modelObj);

    }
}
  • want to move cache objects out side of Assets/ folder

is “cache” means AssetGraph’s Cache folder? or cache of AssetGraph itself?

from assetgraph.

nistake avatar nistake commented on July 19, 2024
  • about custom filters and custom node inspector

Is it difficult to introduce following IBaseNode.OnInspectorGUI() virtual method mechanism for custom node inspector ?

public class CustomRegexFilter : AssetGraph.FilterBase {
    private string pattern = "/monster.*fbx$";
    public override void In(List source, Action> Out) {
        Out("out", source.Where(s => Regex.IsMatch(s, pattern)).ToList()); 
    }
    // **** called from AssetGraph's OnInspectorGUI() ****
    public override void OnInspectorGUI() {
        pattern = EditorGUILayout.TextField("regex pattern", pattern);
    }
}

I think that AssetGraph need not support all editor functions for customized (out side of AssetGraph) nodes.

  • CreateCharaPrefab2

I think CreatecharaPrefab2 is good, but I want to separate prefablication and component settings because component settings tend to be more complex than prefablication itself.
Is it possible to introduce like 'PostPrefablicator' node?

  • is “cache” means AssetGraph’s Cache folder? or cache of AssetGraph itself?

I meant AssetGraph's Cache folder. If too many assets are in AssetGraph's Cache folder, sharing a project between team members may be cumbersome.

from assetgraph.

sassembla avatar sassembla commented on July 19, 2024
  • CreateCharaPrefab2

Separating steps is very good idea.
How about using one more Prefabricator for modify prefab? The Prefabricator node is able to run specific code.
Set 2 Prefabricator nodes, 1st is for generating prefab. 2nd is for adding component to exist prefab.

step by step,

  1. generate prefab in Prefabricator_1.
  2. In Prefabricator_2, instantiate already exist prefab.
  3. add component to prefab
  4. re-generate prefab

codes here.

// This code is arrange of CreateCharaPrefab.cs https://github.com/unity3d-jp/AssetGraph/blob/master/Assets/AssetGraph/UserSpace/Examples/Editor/CreateCharaPrefab.cs

public class CreateCharaPrefab3 : AssetGraph.PrefabricatorBase {
    public override void In (string groupKey, List<AssetGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<GameObject, string, bool, string> Prefabricate) {

        // ... omitted ... //

        // instantiate prefab(already generated by other Prefabricator).
        var prefabObj = GameObject.Instantiate(yourPrefab);

        // add component to it.
        prefabObj.AddComponent<Rigidbody>();

        // then Prefabricate(object, string, bool) method makes prefab for it.

        // In this case, you have already 1 prefab & want to update it.
        // use true for 3rd parameter of Prefabricate method.
        // it means “overwrite if same name prefab is exists.”
        var prefabName = groupKey + "_chara.prefab";
        var prefabOutputPath = Prefabricate(prefabObj, prefabName, true);

        // delete unnecessary prefab instance from hierarchy.
        GameObject.DestroyImmediate(prefabObj);

    }
}

from assetgraph.

sassembla avatar sassembla commented on July 19, 2024
  • about AssetGraph’s Cache folder

sharing a project between team members may be cumbersome

Yes, if try out such a thing, it is not easy.

AssetGraph is the asset that “generate resources for the project in 1 place”.

1 place means “The workspace of member who manage game resources for release”.

I recommend to share only generated assets between teams. Not whole resources of AssetGraph.

And so, The reason why AssetGraph has resources in Assets/AssetGraph/Cache folder is for specification of Unity’s AssetDatabase.

Using resources in UnityEditor requires the recorded GUID of assets. These Ids are recorded by AssetDatabase. and AssetDatabase treats only assets which are located in Assets/ folder.

from assetgraph.

sassembla avatar sassembla commented on July 19, 2024
  • about custom filters and custom node inspector
    // **** called from AssetGraph's OnInspectorGUI() ****
    public override void OnInspectorGUI() {
        pattern = EditorGUILayout.TextField("regex pattern", pattern);
    }
}

Looks nice, but a lifetime of Node instance is not matched to Editor GUI.
There is no dependency between Node-code to GUI now, and this separation is intended.
Thank you.

from assetgraph.

nistake avatar nistake commented on July 19, 2024

Set 2 Prefabricator nodes, 1st is for generating prefab. 2nd is for adding component to exist prefab.

Looks good, I will try it. Thank you !

1 place means “The workspace of member who manage game resources for release”.
I recommend to share only generated assets between teams. Not whole resources of AssetGraph.

I understand. I will try with this in mind.

Looks nice, but a lifetime of Node instance is not matched to Editor GUI.
There is no dependency between Node-code to GUI now, and this separation is intended.

I understand. It looks difficult.

Thanks for clear explanations, I close this issue.

from assetgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.