GetVirtualObjects v GetContour for Spline Gen
-
On 16/11/2016 at 17:37, xxxxxxxx wrote:
Okay, my initial instincts were right. Using GetVirtualObjects instead of GetContour results in a lot of incompatibilities/issues with:
- Any plugin that calls GetRealSpline() as a test.
- Spline Mask Object: Cant' use generated splines as Source.
- Align to Spline Tag: Won't place objects on generated spline.
- Complicates accessing spline points for other deformers/generators.So, now I'm back to one of my initial questions:
How do I hide and retrieve caches for the child objects of my SplineGenerator if I can't use GetAndCheckHierarchyClone() because I don't access to a HierarchyHelp in GetContour()?
-
On 18/11/2016 at 15:24, xxxxxxxx wrote:
- ObjectData plugin, parent change in OM - Plugin Cafe Forums: Thoughts on using CheckDirty to manually trigger recalculation.
- GetContour() issues - Plugin Cafe Forums: Another plugin running into the same issue of needing to use GetContour()
- GetContour() refresh or uncache? How? - Plugin Cafe Forums - Page 1: Tips on how to better calculate whether it's dirty. -
On 24/11/2016 at 02:40, xxxxxxxx wrote:
Hi Donovan, thanks for writing us.
First of all let me apologize for the delay in answering here but it took longer than expected to come out with a reliable and (hopefully) final solution.
After running further analysis based on the issues you've reported we found that Cinema internally uses different approach to test spline based on the tool which is actually using the spline as input.
Although it seems that testing for the OBJECT_ISSPLINE is enough for most of the case the AlignToSpline Tag requires also the GetCountour to be implemented together with the GetVirtualObject.
Under this scenario I've prepared a simple Python plugin that puts the basis for your further development and should solve all the opened issue you've reported. It also hides the child spline in the generator as requested in this other thread of yours and works flawlessly with AlignToSpline, Hair, and all the other generators that make use of splines.The code is available here and feel free to provide any further comments if other issues arise.
Best, Riccardo
-
On 28/11/2016 at 21:34, xxxxxxxx wrote:
Hi Knickknack,
Thanks so much for your detailed response! Your example:
- Works with Align to Spline
- Renders w/ Hair
- Renders w/ Sketch
- Is detected by plugins using "GetRealSpline()"So that's great news!
Unfortunately, I'm still not able to conceal the child objects in the editor - in order to do that, I must make the OffsetYSpline object editable.
I look forward to your input in the other thread: Hide Input Child Objects in GetContour - Plugin Cafe Forums
-
On 01/12/2016 at 11:01, xxxxxxxx wrote:
Okay, I've modified your example and gotten it more-or-less working (I created a Frankenstein combo of it and my earlier experiments).
1. "GetVirtualObject" needed to become "GetVirtualObjects".
2. I needed to create a system that would convert input objects to Osplines so that it would work with primitive splines.
3. GetHierarchyClone doesn't seem to be working properly in Python, so I'm using GetAndCheckHierarchyClone instead.
4. I needed to create resource files in order to execute this, and the ID needed to be increased from 1000 to 10000 (as 1000 is within the protected range for IDs)
5. It was retrieving an Int instead of a Float for the offset value.
6. I added code to account for the transformation of source points back into generator space.
7. Updated the Spline copy code to account for splines with multiple segments.Remaining issues:
8. Not compatible with Hair Render, but *is* compatible with Sketch.For anyone trying to recreate this on their own, it seems like the key trick being used in Riccardo's example is to manually generate a SplineObject() to be returned by GetVirtualObjects instead of a c4d.BaseObject(c4d.Ospline).
-
On 02/12/2016 at 09:15, xxxxxxxx wrote:
Hi Donovan, thanks for the feedback.
I apologize for the silence but unfortunately in these last days I've had to focus on other tasks also beside this current one. I thank you for pointing out the typo in the code which was something I forgot to mention here and to update on PasteBin.
At this time of writing I confirm I've approached to a solution which works properly fine with most of the test case fixing all the issues you mentioned above as well as those others I run into during code design. The design has been ported on C++ and Python providing native hiding for the input spline on both.I do look forward to post this solution on Monday after some other corner cases will be tested as well as to hear from your tests
Best, Riccardo
-
On 13/12/2016 at 03:40, xxxxxxxx wrote:
Thanks for responding. Any news on that example?
-
On 14/12/2016 at 00:23, xxxxxxxx wrote:
I apologize Donovan for the unexpected delay. I'm strongly still looking to solve some corner cases where it fails in order to provide a solid solution. Please keep tuned.
Best, Riccardo
-
On 15/12/2016 at 13:04, xxxxxxxx wrote:
Good morning Donovan, once again i'm terribly sorry for getting back to this topic after such a long period but the topic has revealed being trickier than expected with nifty situations tough to debug and solve in the end.
At the following link you should find a solution which should properly work in almost all the cases although it's still susceptible of further improvements (for example with spline mask there are evident limitation compared to the c++ version)Let me know how fits with your needs.
Best, Riccardo
-
On 15/12/2016 at 15:26, xxxxxxxx wrote:
Thanks you Riccardo.
For a c++ exemple does it's the same code converted in c++ or you use others functions?
-
On 15/12/2016 at 21:08, xxxxxxxx wrote:
Hi Riccardo,
Thank you so much for your work on this! I'll use this as a jumping-off point for my own work. For those reading, the following issues remain:
1. Tangents aren't properly handled when the OffsetSpline objects is moved/rotated away from world origin.
2. You get a console error if you put an empty spline mask generator as the child of the OffsetSpline object.
3. If you make the spline editable, the transformed points return to their starting position (I think this is because access to the deformed cache is lost?).
4. Making the spline editable results in a very dense spline (akin to what you would get after using Current State to Object instead of Make Editable) even though the generator is only doing simple point transformations on the input spline.
5. Disabling some of the middle OffsetYSpline generators in a heavily nested chain can give no result, but toggling them on/off again restores the object (perhaps an issue of a missing cache?)It's proving to be a pretty thorny problem. If the C++ code works significantly better, I feel like enough of the bones are there that I could hack around and get a workable result even though I'm not familiar w/ C++. Do you have a working C++ example?
Thank you!
Donovan
-
On 16/12/2016 at 03:48, xxxxxxxx wrote:
Hi Donovan, thanks for getting back and for posting your impressions.
With reference to the issue reported I confirm that:
1. Fixed in Pastebin (0.2.1)
2. Fixed in Pastebin (0.2.1)
3. Fixed in Pastebin (0.2.1)
4. Not reproducible (the topology is kept exactly as the input child)
5. Not reproducible (even with very complex nested OffsetYSpline hierarchies disabling/enabling child worked properly)Best, Riccardo
-
On 16/12/2016 at 09:53, xxxxxxxx wrote:
Hi Riccardo,
Thanks for the updates! Is there any chance you could post Github Gists in the future so that it's easier to track which changes you've made?
4. Dense Spline
Add a Flower spline
Make it editable
Note that there are about 16 points.
Make it a child of an OffsetY spline, make it editable.
Note that there are dozens of points.It's somewhat debatable whether this is a bug as it allows for deformed objects as input, but the problem is that for spline-modeling operations you want to preserve the user-created points as much as possible without adding the auto-interpolated points.
http://imgur.com/a/E2bBz5. Objects go missing
http://imgur.com/a/4sCRO
http://imgur.com/a/gnhPJ
Example file: https://dl.dropboxusercontent.com/u/38130065/Bugs/DisappearingChildObjects.c4d -
On 19/12/2016 at 06:44, xxxxxxxx wrote:
Hi Donovan, thanks for providing these additional info.
With reference to the first encountered limitation, when you try to make editable any generator using spline as input element - whatever it is mine or the spline mask or even in the extrude but in this last you should switch the display to Lines - the number of points is increased because making the curve editable seems to not retain the curve parameters set and converts the curve topology current type (Bezier, B-Spline, Akima etc etc) to linear resulting in an increased number of points to keep the resulting curve in tolerance. Under this scenario further investigation could be took in consideration later on.
(Limitation01)For the second limitation (object missing) it's by design because only the first child is considered as valid input object for my generator. If you promote the child listed in the second place in your second image to first child you will see the generator operating as expected.
Best, Riccardo.
-
On 20/12/2016 at 15:46, xxxxxxxx wrote:
Hi Riccardo,
I'll concede the first limitation.
For the second, compare this to the behavior of the Symmetry object. The generator only acts on the first child, but it doesn't hide/delete subsequent children. This way you can child objects to the generator without having to worry about complex null structures.
-
On 21/12/2016 at 00:57, xxxxxxxx wrote:
Donovan, thanks for further comment and I'd say it would be not that hard to fix.
That said, as already stated, although the provided solution is still perfectible I'd call it done (considering that 95% of the initial issues have been addressed) and leave to the community the next steps.
Best, Riccardo
-
On 21/12/2016 at 13:49, xxxxxxxx wrote:
Thanks Riccardo, working on it now!
-
On 22/12/2016 at 14:47, xxxxxxxx wrote:
Alright, I've made a GitHub repo for Py-OffsetYSpline. I'll be working on the last few edge cases. If you have any suggestions for improvements please fork and make changes or add an Issue to the issues list.
-
On 29/12/2016 at 23:33, xxxxxxxx wrote:
Okay, I'm a bit further down the path and I'm running into some thorny issues with objects constantly rebuilding. It seems like the system for checking whether the generator or children are dirty returns dirty every other time. This means that the object is regenerated every other redraw
It's not so slow when testing the object on its own, but once you start nesting them and then extruding the results - you're taking a scene down from 120fps down to 5 or 6.
It seems like the touch() is partially responsible as touching the object updates its dirty checksum. GetAndCheckHierarchyClone() returns a useful dirty result for children, but I suspect it's quite slow as I think it forces all children to regenerate when their GetContour() methods are called via GetRealSpline().
Anyone have any examples of: Spline Generators that use Input Objects that update in real-time, but only when changes are made - not constantly?
-
On 30/12/2016 at 08:50, xxxxxxxx wrote:
Hi Donovan, I've quickly looked into the issue mentioned and it seems that the GetAndCheckHierarchyClone () returns a "positive" dirty value even when nothing has changed on the input object. Because of this unexpected behavior, since the child dirty status is checked by the RecursiveCheckDirty function, commenting the below line just after the GetAndCheckHierarchyClone call
should fix the issue.dirty |= cloneDirty
Looking forward hearing from you, give best.
Riccardo