11
$\begingroup$

I have a 3DConnexion SpaceNavigator. It works very well for moving the viewport. Is there a way for it to place an object in the scene?

Is this something that can be accomplished via an addon? I am new to Blender, I'm delighted that the NDOF works out of the box, but I expect to be able to place objects using it. Would be much more intuitive than using a mouse.

So far I have setup a ViewOperator template and I can see that moving the 3D mouse yields a NDOF_MOTION event

def modal(self, context, event):
        v3d = context.space_data
        rv3d = v3d.region_3d

        if event.type == 'NDOF_MOTION':
            print(event)

blender console when moving the 3d mouse: <bpy_struct, Event at 0x000001B72D13B5F8>

I can see how I might write a script to move an object given the motion event. The problem is I can not find any way to get data from the event. I am expecting some translation/rotation vectors but those properties don't seem to exist on the Event object.

I believe the c implementation to move the viewport is here: ndof_orbit_zoom_invoke() in https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_view3d/view3d_edit.c

const wmNDOFMotionData *ndof = event->customdata;

There is no customdata on the event when it gets to my python script.

Which makes sense because there is no mention of any relevant data in rna_def_event() here: https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_wm.c

$\endgroup$
4
  • $\begingroup$ Did you ever figure this out? We are very interested in using the 3D mouse to move models in the scene. $\endgroup$
    – Madcowswe
    Mar 12, 2018 at 2:03
  • 2
    $\begingroup$ @Madcowswe No, unfortunately. This caused me to lose interest in Blender and I've since moved on. $\endgroup$
    – meta-meta
    Mar 16, 2018 at 22:05
  • 1
    $\begingroup$ Stack Exchange isn't the only source of information! You can always drop by on IRC (FreeNode, channel #blender), join mailing lists, or chat at Blender.Chat. $\endgroup$
    – dr. Sybren
    Mar 18, 2018 at 9:08
  • $\begingroup$ @Madcowswe have you asked around on IRC? $\endgroup$
    – meta-meta
    Mar 22, 2018 at 15:23

2 Answers 2

3
$\begingroup$

Indeed, presently, there is no ndof_motion field in the python Event struct.

I checked in with Blender's Python API module owner @ideasman42 on the #blendercoders IRC channel, and he gave the thumbs up to expose this data with an added field. So I will try my hand at adding that. Assuming that all works out, it should then be possible to make your proposed addon.

$\endgroup$
4
  • $\begingroup$ What's the status of this? Did you get it to work? How can I access it in python? $\endgroup$ Nov 27, 2018 at 15:45
  • $\begingroup$ @JamRisser Sorry I ran out of time for this project, so I don't think I will be able to do it any time soon. It didn't look very complicated to do this though, so I'd recommend doing it if you have the time. $\endgroup$
    – Madcowswe
    Dec 1, 2018 at 7:10
  • $\begingroup$ Could you give me a jump start by sharing your work with me? $\endgroup$ Dec 1, 2018 at 7:12
  • $\begingroup$ @JamRisser I never got to writing any code, but I remember that between the rna_def_event() in developer.blender.org/diffusion/B/browse/master/source/blender/… and the python event struct, I think that's the main path to get the data out by adding to those. There may be more to it, but then I would ask @ideasman42 on the #blendercoders IRC channel. $\endgroup$
    – Madcowswe
    Dec 5, 2018 at 0:23
2
$\begingroup$

I'm not sure if anyone is still interested with that but I made an addon for blender (on windows system only) to move object with a NDOF 3d connection space mouse. You can find my tutorial on Youtube : https://youtu.be/Zw79EofTLbs And the addon itself on Gumroad : https://julienroy.gumroad.com/l/TelekiNDOF

$\endgroup$
1
  • $\begingroup$ Hi, thanks for the post. This site is not a regular forum, answers should be substantial and thoroughly explain the solution and required workflow. One liners and short tips rarely make for a good answer. If you can edit your post and provide some more details about the procedure and why it works feel free to restore it, otherwise it may be deleted or converted into a comment. Perhaps add a few images illustrating the workflow and final results. See How do I write a good answer? $\endgroup$ Oct 29, 2021 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .