Comments (7)
And of course I can use the isPreview()
option and create just brick model (which helps a bit) for interactive viewing, but then I'd sometimes like to see the final one on the editor too.
What if there were two toggles on the scripted object editor: Still / Animating and Preview / Final? -- Then there should probably be something to detect if isPreview()
or Time()
are used in the script or the parameters.
from artofillusion.
a repetitive pattern that changes along distance.
Do you mean 'changes based on location in scene' or something else?
If this really is a static object, or one that only changes at a few specific points on the timeline, the script should cache the completed CSG model, and perhaps a converted TriangleMesh. Just use the cached object unless the time/location/whatever invalidates the current shape.
from artofillusion.
'changes based on location'
Yes, basically so. The changing dimensions happen in local space and the scripted object actually reads some dimensions from a hand sketched curve on the scene.
script should cache the completed CSG model
Now that you say it, I think I may have tried something like that before. -- I think I used a separate script to reset the scripted object (= set the object in memory to null
)... I think that could be done by a boolean variable in groovy memory.
The content of the scripted object is actually
50 CSGObjects × 2
1 Cylinder × 50
1 Cylinder × 1
1 Sphere × 1
12 parameters to control the build.
So to cache it I'd have to cache the parameters, the vertex positions of the curve and each object with the list of coordinate systems where to add it. Then the script should check the if any of the parameters or the extra boolean or the control curve have changed to make the decision if it should recreate the objects or use the ones in the memory...
So far I have used @field and/or declared each variable, because undeclared variables that float in the memory tend to ... well ... be remembered even when they have become obsolete and then the next time I open the scene the script may not work.
Something like that?
from artofillusion.
While doing a little digging to make sure I understood the question in #241, I found that ObjectCollection
(Which ScriptedObject
derives from) already caches the object structure under the hood. If it's rebuilding for every frame, your script is either:
- Calling for the current time, and (not?)changing things based on that time
- Calling for coordinates, and (not?)changing things
The content of the scripted object is actually
That's a lot going on in a single scripted object. How many of these objects:
- Actually depend on time, directly or indirectly?
- Depend on location of the
ScriptedObject
? - Depend on location of/shape of another object?
Of those 12 parameters, how many vary based on time? (IE, have a track)
from artofillusion.
I see...
None of them depend on time in any way or have tracks or depend on the location of the object. The 50 CSGs depend of a curve on the scene. The curve is not moving and the location of the curve is not a factor, only vertex positions are used.
What is done, is that the scripted object gets a duplicate of the curve, subdivides it a few times, get vertex vectors into an array and then finds (by linear interpolation) the corresponding x-value for each of the 50 y-values that define the CSGs.
So the way to tame it down would be to extract vertexPositions()
of the (unsmoothed) curve by other means and save those as an array in the script text? (A script to build a scripted object is not entirely alien to me. -- Type a marker in the scripted object text and tell a tool script to edit that part....) -- And then recreate the curve inside the scripted object and start smoothing...
It's a kind of pity I can't show the thing (not until it's public anyway) but I'm doing it for somebody else.
from artofillusion.
This doesn't sound like it should be re-building on every frame.
By default, each object does have a position & rotation track, even if there are no keyframes. Maybe that's enough? Try manually deleting these tracks from the curve object, and see if that makes a difference.
So the way to tame it down would be to extract vertexPositions() of the (unsmoothed) curve by other means and save those as an array in the script text?
I don't know if that would help, and shouldn't be necessary.
Would it be possible to share a "Anonymized" version of the script? I'm thinking:
- 1 or 2 CSGs made up of a couple of random sphere/cylinder/whatever to stand in for your actual models
- A simple curve, maybe no more than 3 or 4 points
- 1 or 2 parameters
What I'm really interested in is:
- How the parameters are input to the script
- How all of the parts interact:
- What math and logic are used to interrelate them?
- How and when are the various inputs changed?
from artofillusion.
How the parameters are input to the script
I said parameters but what I mean is just typed in values of variables (that are in essense parameters of the process of creating the objects) -- so no script parameters involved. Like double size = 0.5; Cube cube = new Cube(size, size, size);
I'll come back to with example script.
from artofillusion.
Related Issues (20)
- Script editor window closing loses already saved changes HOT 21
- FileChoosers are missing file type filters HOT 2
- Clean up older Pull requests. HOT 1
- Migrate to build system with managed dependency support
- RFE. Extract procedural modules to separate plugin sub project HOT 3
- Loading freeze for object-script that tries to access the object list HOT 7
- Could not Bulk Edit on ScriptedObject Pose track HOT 2
- Text Area on script editing windows does not resize on maximize/restore.
- Script UI objects can be orphaned HOT 4
- Triangle mesh constructor description HOT 4
- Menu shortcuts conflict for Africaans language HOT 4
- "Transfrom Object..." order of operations is wrong HOT 15
- AOI hangs on shutdown if SPManager has been opened.
- Rotation angles calculation does not give optimal results HOT 3
- Can not compile. Recenet change in code?? HOT 9
- Start-up settings to core AoI HOT 4
- Problem rendering multiple scripted objects (Groovy related) HOT 5
- Probably bad Startup Scripts execution order HOT 11
- SceneCamera revision HOT 7
- Camera view RENDERED mode gets copied to RenderScene HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artofillusion.