TreeView Shift Click & Keyboard Arrows Input
-
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.