Spline gui min/max
-
On 31/03/2015 at 04:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;---------
Hi folks,I've realised I need to change the min/max for the spline gui. So, not SetRange() on the spline data, but the min and max values of the grid itself.
I need for instance, to set the gui's x min to 1.0 instead of the default 0.0. How can I do this?
I don't know if this is also where the above might be answered, but how can I update/change, or access, the gui's BaseContainer elements after it's been made? I'm wanting to update elements like the above min/max (SPLINECONTROL_X_MIN) and a few others. Can this be done after the gui is made, or do I have to destroy it and again?
WP.
-
On 31/03/2015 at 06:30, xxxxxxxx wrote:
Hello,
a custom GUI element does not have a BaseContainer. But you typically use a BaseContainer to hand over parameters to the custom GUI when you create it. So the minimum and maximum value can be define like this:
BaseContainer settings; settings.SetFloat(SPLINECONTROL_X_MIN, 3.0); settings.SetFloat(SPLINECONTROL_X_MAX, 4.0); // further settings ... AddCustomGui(123456,CUSTOMGUI_SPLINE,"Spline Custom GUI",BFH_SCALEFIT,100,100,settings);
The full list of settings for SplineCustomGui can be found in the documentation. It is typically not possible to change these settings after the custom GUI was created.
Best wishes,
Sebastian -
On 31/03/2015 at 17:42, xxxxxxxx wrote:
Originally posted by xxxxxxxx
It is typically not possible to change these settings after the custom GUI was created.
Ah - thanks Sebastian, I thought that might be the case. I'll destroy the gui element and rebuild it with the updated attributes.
Cheers!
WP.
-
On 31/03/2015 at 18:12, xxxxxxxx wrote:
Oh hang on - I'm missing the first bit! What about the setting of the minimum x value on the graph draw itself? Can we start that with an alternate number (e.g. 1.0 instead of the default 0)?
WP.
-
On 01/04/2015 at 01:39, xxxxxxxx wrote:
Hello,
in the above code example I define a custom range for x-values of 3 to 4. Is that what you mean?
best wishes,
Sebastian -
On 02/04/2015 at 03:37, xxxxxxxx wrote:
Oh, I see what's going on. The SplineData's range can affect the graph draw. That's now been altered so the first point is now at 1. That's fixed one part of it.
But it's still not really drawing it the way I had hoped. Take a look at the image in the link below, it illustrates what I'm referring too. You can see that the graph is starting at 1, but the graph draw itself is still using 0. Is there anyway to override this?
http://postimg.org/image/eyki3hkl9/
WP.
-
On 02/04/2015 at 05:14, xxxxxxxx wrote:
Hello,
can you give us some example of your code and data to reproduce the described behavior?
Best Wishes,
Sebastian -
On 02/04/2015 at 18:00, xxxxxxxx wrote:
Yeah sure,
// SplineData allocation: Spline_1 = SplineData::Alloc(); Spline_1->SetRange(1.0,100.0,0.0,0.0,200.0,0.0);
// this is in the constructor of the object which 'owns' the spline // gui. I set up the bc first, and use the same container each time // the spline gui is made. Spline_Gui = NULL; SplineGui_bc.SetBool(SPLINECONTROL_GRID_H,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_GRID_V,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_VALUE_EDIT_H,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_VALUE_EDIT_V,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_VALUE_LABELS_H,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_VALUE_LABELS_V,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_PRESET_BTN,FALSE); SplineGui_bc.SetBool(SPLINECONTROL_ROUND_SLIDER,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_NO_PRESETS,TRUE); SplineGui_bc.SetBool(SPLINECONTROL_NO_FLOATING_WINDOW,TRUE); SplineGui_bc.SetReal(SPLINECONTROL_X_MIN,1.0); SplineGui_bc.SetReal(SPLINECONTROL_OPTIMAL_X_MIN,1.0); SplineGui_bc.SetString(SPLINECONTROL_X_MIN_TEXT,LongToString(1));
// the spline gui's AddCustomGui() function. "Dialog" is just a // reference to the GeDialog where the groups and spline gui are. Spline_Gui = (SplineCustomGui* )Dialog->AddCustomGui(SPLINE_GUI_ID,CUSTOMGUI_SPLINE,"",BFH_SCALEFIT|BFV_SCALEFIT,NULL,NULL,SplineGui_bc); Spline_Gui = (SplineCustomGui* )Dialog->FindCustomGui(SPLINE_GUI_ID,CUSTOMGUI_SPLINE);
I think that covers it, but let me know if you need more.
WP.
-
On 07/04/2015 at 05:11, xxxxxxxx wrote:
Hello,
looking at the issue it seems that this is the correct behavior. The Spline GUI will create the axis label (and the grid) dynamically. The label is based on the min and max values but what is visible depends on the actual GUI size. So only certain numbers are visible and there is a certain delta between the numbers.
For example take the range of 10 to 28. Depending on the GUI size it will show numbers with a delta of 4. So the first visible number can be 12 and not 10.
best wishes,
Sebastian -
On 07/04/2015 at 16:06, xxxxxxxx wrote:
Hi Sebastian,
thanks for clarifying that. It appeared it was doing something like that, so you're probably spot on!
Maybe the spline gui needs an attribute where coders can override the gui draw's starting and ending values. If the graph was made to operate between 7-96, it could still draw a delta of 10 in between, and just ignore the first and last 10th (so 10, and 90) if they're too close to the starting and ending values. This would be quite useful for animators etc, particularly if coders (and the end user) were wanting to draw a curve that is meant to operate between frames 7 and 96. Maybe something for the devs to think about?
Thanks again,
WP.