-
Notifications
You must be signed in to change notification settings - Fork 316
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
Macro trait/prop parser #2472
Comments
This is awesome! I guess it could be integrated very similar to how it's currently done. My proposal:
I really like the idea of adding more attributes to the property metadata even though the min/max settings probably have to wait until Armory can use the new property API in Blender 3. What would be the difference between |
I don't think the server can read the trait information from compiled output, but we could cache it by writing the last state into a file. This would make trait information available on blender start (again, if it has been build and the Trait module files have modtime < cache file modtime) Cleaning the project should be ok since we can generate project-krom.hxml quickly by running khmake with --nohaxe --noshaders. The haxe source files would still be cached by the server from last compilation. Technically i see no problem with having a server-only mode, most glitches and unexpected behaviours come from network port conflicsts when multiple instances of the server are running (Somehow everybody wants to run haxe on port 6000). You are right |
Does this still export assets? Because otherwise user code may fail because Kha's asset macros (e.g.
Networking noob here, but would it be possible to let the Blender instances communicate to choose a free port? |
This could be a problem indeed. Is there an explanation for what cleaning is actually good for? I think the easiest way to exchange running server information would be to write it into a /tmp/file but this sounds far out the core problems facing here. |
The Kha asset builder creates the public fields based on the
I guess it's there to do a clean rebuild in case something in the cache is not correctly updated (which to be honest happens way too often...). Visual Studio for example has a similar option. |
Do you know whether it's possible in Haxe to implement an equivalent to Python's I think it's better to instead improve Armory's caching, try to optimize Kha's build times (or perhaps even add support for building a project incrementally in Khamake) and then require the user to build the project before any traits can be parsed. But it will take a while and a lot of work to get there... |
This seems to be possible using |
Following the discussion at #2291 i've created a haxe macro which writes trait information json format to stdout.
The idea is to replace the current (python) @prop parser, which would have several advantages:
Some meta data usage ideas:
@prop({min:0,max:10})
Allowed value range forInt
,Float
andString
(min/max length)@prop({internal:true})
To hide the property in blender ui (access from code only)@prop({required:true})
Show error in blender ui if no value has been setDownsides of this approach are that it only works for already built projects and the mandatory usage of the haxe build server to have bearable build times. Fully cached, a request to this macro takes about 100-200ms.
Any thoughts welcome!
Example:
Call the macro:
haxe --no-output --cwd build_test/debug project-krom.hxml --macro 'armory.macro.Build.fetch_traits(true)'
Outputs:
The text was updated successfully, but these errors were encountered: