Setting SplineData gridlines through code

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2012 at 11:41, xxxxxxxx wrote:

How can I change, in python, the number of gridlines (vertical or horizontal, it doesn't matter) of a SplineData field?
I know that I must use:

SplineCustomGui.SetGridLineCountH(n)

for setting the number of horizontal lines. But how?!?!

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2012 at 12:36, xxxxxxxx wrote:

If, at least, I knew how to get the SplineCustomGui of my SplineData.
But that is not clear in the SDK 😞
If I can't even get the SplineCustomGui of an element, how am I supposed to use SetGridLineCountH(n)?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2012 at 14:24, xxxxxxxx wrote:

Damn! I can't even create an instance with:

customgui=c4d.gui.SplineCustomGui()

What can we do with this class?!?!?

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2012 at 15:52, xxxxxxxx wrote:

This is exasperating!!!
How is it that something as simple as changing the number of gridlines of a spline data element proves to be soooooo complicated?!
If a class is not accessible, why is it in the SDK?

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2012 at 16:12, xxxxxxxx wrote:

I have read this in the C++ SDK:

Spline data type (CUSTOMDATATYPE_SPLINE) for the SplineCustomGui GUI. Cannot be instantiated directly.

If it can't be instantiated directly, how can we instantiate it indirectly?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 15/09/2012 at 13:33, xxxxxxxx wrote:

Hello Rui, _

> > If it can't be instantiated directly, how can we instantiate it indirectly?_
GeDialog.AddCustomGui() instanciates it internally and returns a reference to the created BaseCustomGui instance. I couldn't find a way, in Python, to retrieve a custom-gui that was instantiated by the dialog-resource loader.

But afaik you are currently working on an Object plugin. Afaik we are not able to obtain the BaseCustomGui instance from descriptions. I'm sorry but I can not tell you how to do what you want to achive. I'm actually not even sure how to do this in C++. An official statement would be very appreciated!

-Niklas

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 16/09/2012 at 00:47, xxxxxxxx wrote:

+100
i can't get it too.
sample code:

import c4d  
from c4d import gui,storage  
  
SPG = 1001  
DGR = 1002  
BUTTON_1 = 1003  
  
class TestSplGui(gui.GeDialog) :  
  global spl  
  def CreateLayout(self) :  
      global spl  
      self.AddButton(BUTTON_1, c4d.BFH_LEFT, 150, 15, "Test")  
      self.LayoutFlushGroup(1002)  
      self.GroupBegin(DGR, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)  
      bc = c4d.BaseContainer()  
      bc[c4d.SPLINECONTROL_GRID_H] = False  
      bc[c4d.SPLINECONTROL_GRID_V] = True  
      bc[c4d.SPLINECONTROL_Y_MIN] = 0  
      bc[c4d.SPLINECONTROL_Y_MAX] = 50  
      bc[c4d.SPLINECONTROL_MINSIZE_V] = 10  
      bc[c4d.SPLINECONTROL_GRIDLINES_V] = 50  
      spl = self.AddCustomGui(SPG, 1009059, "", c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0, bc)  
      self.GroupEnd()  
      self.LayoutChanged(1002)  
      return True  
  def InitValues(self) :  
      self.SetTitle("Test")  
      self.GroupBegin(DGR, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)  
      self.GroupEnd()  
      return True   
  def Command(self, id, msg) :  
      global spl  
      if id==BUTTON_1:  
        print spl.GetGridLineCountV()  
        spl.SetGridLineCountV(10)  
        print spl.GetGridLineCountV()  
      return True  
  
if __name__=='__main__':  
  dlg = TestSplGui()  
  #DLG_TYPE_MODAL = > synchronous dialog  
  #DLG_TYPE_ASYNC = > asynchronous dialogs      
  dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=800, defaulth=600)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 16/09/2012 at 03:25, xxxxxxxx wrote:

Thank you for the replies.
So, Maxon, if it is impossible to get access to that, why is it in the SDK?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/09/2012 at 02:08, xxxxxxxx wrote:

Originally posted by xxxxxxxx

So, Maxon, if it is impossible to get access to that, why is it in the SDK?

It's in the SDK because (same as what Niklas said before) GeDialog.AddCustomGui() creates an instance of a SplineCustomGui in a dialog if you call it with CUSTOMGUI_SPLINE.
But when you declare it in a description you don't have access to the SplineCustomGui, only the SplineData. In that case in the resource description file you can set the number of grid horizontal/vertical steps with GRIDSIZE_H/GRIDSIZE_V flags. You can look at the Spline Deformer resource file to see how a SPLINE description element can be declared: resource\modules\objects\res\description\osplinedeformer.res.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/09/2012 at 02:40, xxxxxxxx wrote:

I have set the grid divisions in my description file.
But my plugin creates sets of knots dynamically and I would like to match the grid divisions with the number of knots created.
It is a shame that it can't be done 😞