TreeView Shift Click & Keyboard Arrows Input
-
On 08/06/2016 at 18:39, xxxxxxxx wrote:
Hi,
I'm currently using a TreeViewCustomGui to list all of the selection tags on an object. It's going well, but I can't replicate some of the behaviors of the object manager & layers manager I would like. Are these limitations, or am I doing something wrong? I would like:
- Shift + Click for selections: At the moment, I can Ctrl-click to add/subtract individual rows, but holding down shift does not allow for multiple selection as you see in the Object Manager.
- Up/Down Arrow Support: In the OM if I click on an object name and use Up/Down arrows, I can select the objects above/below. Paired with SHIFT I can select lots of objects via keyboard quickly.
- Enter/Return to Rename
- Icons before object names: I'd like to draw the icons after the Hierarchy lines, but before the object name like you see in the Object Manager.I'm using Niklas' TreeView GitHub Gist as my jumping off point if you want a working code example.
Thanks,
Donovan
-
On 09/06/2016 at 02:53, xxxxxxxx wrote:
- Shift + Click for selections : If you implemented Select() correctly, it should work automatically (ie. handle SELECT_NEW, SELECT_ADD, SELECT_SUB)
- Up/Down Arrow Support : Not sure about this one, maybe TREEVIEW_CURSORKEYS is the right option to enable?
- Enter/Return to Rename : Make sure TREEVIEW_NOENTERRENAME is not enabled.
- Icons before object names : You have to add an additional column to draw the icons in manually or make that column also draw the name if you want the icons to appear right in front of the names (like in the OM) instead of in a separate column. The column type is LV_USER or LV_USERTREE depending on whether you want that column to have the collapse/expand markers or not.
Hope this helps,
-Niklas -
On 09/06/2016 at 11:30, xxxxxxxx wrote:
Hi Niklas, thanks for responding!
- Shift + Click for selections doesn't work in your Python TreeView example. Is that an issue in your implementation of the select commands, or an issue with the API?
I'm currently investigating the rest.
-
On 09/06/2016 at 12:04, xxxxxxxx wrote:
Here's an updated Gist w/ the flags set as you recommend.
https://gist.github.com/donovankeith/01b520c03343a3bfc471a9cf13333859
-
On 09/06/2016 at 14:31, xxxxxxxx wrote:
Hm you're right, Shift+Click to select a range of elements doesn't work. But Ctrl+Click does to select/deselect individual elements does. Not sure how to make Shift+Click work.
But using doc.SetActiveObject() instead of manually setting the bits is definitely better, but the other version demonstrates the use of the Select() method better I think.
-
On 09/06/2016 at 14:37, xxxxxxxx wrote:
Also Enter/Return to rename doesn't seem to be working even w/ Flags appropriately set.
-
On 14/06/2016 at 03:14, xxxxxxxx wrote:
Hi,
I confirm the TreeView gives multi-selection order with the Shift key from top to bottom.
This means TreeViewFunctions.Select() is called for each object from top to bottom even if selected in the reverse order.About the rename, TREEVIEW_NOENTERRENAME flag is not set by default and renaming should work if TreeViewFunctions.SetName() is implemented and actually changes the name.
In the SetName() of Niklas' example a call to EventAdd() is missing after obj.SetName(name).Finally, contrary to all expectation the Object Manager doesn't use the TreeViewCustomGui.
-
On 14/06/2016 at 05:55, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Finally, contrary to all expectation the Object Manager doesn't use the TreeViewCustomGui.
!
Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED]!Shocked
[URL-REMOVED] That's newsIn the SetName() of Niklas' example a call to EventAdd() is missing after obj.SetName(name).
Thanks for the hint. Fixed
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 14/06/2016 at 16:09, xxxxxxxx wrote:
Thanks @Niklas and @Yannick! I've been hacking away at this with some success, but even using all of the suggestions above, my initial questions still remain. Using the Python API, has anyone succeeded in getting the following to work without writing custom methods?
- Shift Click to Select in Treeview
- Up/Down keys move selection up/down
- Enter/Return to renameI assume that styling the icons like the OM isn't native functionality as they're not based on the same Class.
-
On 15/06/2016 at 07:24, xxxxxxxx wrote:
Hi Donovan,
What do you mean by "without writing custom methods"?
-
On 15/06/2016 at 11:43, xxxxxxxx wrote:
Looks like I needed to set this bit:
tree_gui_settings.SetBool(c4d.TREEVIEW_CURSORKEYS, True) # Process Up/Down Arrow Keys
I also got Shift select working in a simple test, so it's probably something to do with my using doc.SetActiveTag() in my code that is giving me issues, I'll keep debugging and post my results here. For now, this Gist contains a simple example that seems to work
-
On 15/06/2016 at 16:31, xxxxxxxx wrote:
Okay... I've been plugging away at this for some time with no luck. Best I can tell, Shift-Click to select doesn't work when using BaseList2D objects.
I've ported the example from TreeViews Made Easy Pt 1 & 2 to Python. You can view it here in this public Gist: ShaderBrowser.pyp
C4D recognizes the first ShiftClick if you've never selected anything before - but after that, if you shift + click the Select() method isn't called again.
I'd really appreciate any insight you might give.
Thanks!Donovan
-
On 15/06/2016 at 23:44, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Okay... I've been plugging away at this for some time with no luck. Best I can tell, Shift-Click to select doesn't work when using BaseList2D objects.
At least for C++ this isn't true. Maybe it's a bug or limitation? Did you try to explicitly cast your objects to BaseList2D?
-
On 17/06/2016 at 11:49, xxxxxxxx wrote:
Okay... some progress. Shift-click is working if I wrap the BaseList2D object in a custom class. It seems like passing around the Object/Material/Tag itself as opposed to a custom Python object containing a reference to that object prevents the Select() method from being called when Shift is held down. I have no idea why that might be, but I'm happy to have found a workaround.
-- EDIT --
Here's a GitHub Gist with working shift & up/down arrows. It feels a bit hacky, and I'd still love to know why the Select() method isn't being called by C4D when BaseList 2D items are Shift-Clicked.