Undraw Slider in TreeView?
-
Hi Everyone!
There's a Treeview with Slider for each item, but I don't want to draw slider for some of them, similar to Field List in Cinema, but in the Python Documentation it's just havesilderInfo["state"]
for activation of slider, but not draw or undraw.
And Same question for DropDown menu in TreeView, So is that posible to do that?
Filed List in Cinema
There is my test
def GetFloatValue(self, root, userdata, obj, lColumn, sliderInfo): if lColumn == Slider_col: if not obj.name== "Test02": sliderInfo['minValue'] = 0.0 sliderInfo['maxValue'] = 2.0 sliderInfo['minNominalValue'] = 0.0 sliderInfo['maxNominalValue'] = 1000000.0 sliderInfo['increment'] = 1.0 sliderInfo['state'] = 1 else: sliderInfo['state'] = 0
-
Hello @gheyret,
Thank you for reaching out to us. For my own clarity, what you want to do, is add an LV_SLIDER column to a
TreeViewCustomGui
but than have this column only being drawn on specific rows, right?You can reuse
LV_CHECKBOX_HIDE
for this, at least that is how we do it in C++. I have never tried this in Python but I do not see why it should not work there. Find a pseudo-code example below.Cheers,
FerdinandCode:
"""Demonstrates pattern to hide specific cells in a tree view that are not drawn by ourselves, using the flag LV_CHECKBOX_HIDE. THIS IS UNTESTED PSEUDO CODE. """ import c4d import mxutils class TreeItem: """Represents a tree of items. """ def __init__(self): self._children: list[TreeItem] = [] self._noSlider: bool = False class MyFunctions (c4d.gui.TreeViewFunctions): def GetFloatValue(self, root: TreeItem, userdata: TreeItem, obj: TreeItem, lColumn: int, sliderInfo: dict) -> None: """Called for each slider in the tree view to get its float value and settings. We use it here to hide item that are noSLider == True. Similar things can be done in other tree view methods such as IsChecked, GetDropDownMenu, etc. """ # When the incoming #obj is a TreeItem and has _noSlider set to True, we hide the slider # by joining LV_CHECKBOX_HIDE into its "state" attribute (which is more a flag than a state). if mxutils.CheckType(obj, TreeItem)._noSlider == True: sliderInfo["state"] |= c4d.LV_CHECKBOX_HIDE
-
Hi!@ferdinand
Yes , That's what i want to do!
I never didn't know LV_CHECKBOX_HIDE would work with LV_SLIDER, I simply assumed that it would only work with LV_CHECKBOX and LV_CHECKBOXUSER.
But anyway i test it in my code , and it works perfectly!
Thank you so much for your reply.Cheers~