Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Drag and Drop - Python

Discuss help and learning documents. Submit your ideas for future tutorials and documents

Drag and Drop - Python

Postby raganmd » Wed May 27, 2015 1:52 pm

Hi All,

So I've been looking through the wiki, and I can't seem to find the Python Equivalents for the Drag and Drop TScript args http://www.derivative.ca/wiki088/index.php?title=Drag-and-Drop. Where's the right place to start looking?

Thanks!
Matthew
raganmd
 
Posts: 1058
Joined: Thu Mar 28, 2013 5:21 am
Location: San Francisco, CA

Re: Drag and Drop - Python

Postby elburz » Thu May 28, 2015 12:15 am

You using it with a panel?

Most args like $arg0 $arg1 become args[0], args[1], etc etc

So you can make a Text DAT inside of a panel, put:

Code: Select all
print(args[0])


Then in the panel drag and drop settings, point it at that script, then drop something onto the panel.

Im not at my machine to 100% test that, but I did a project with that recently and that's what I remember doing.

Where to look? That's a tougher question to answer...
--
Elburz Sorkhabi
Creative + Technology
nVoid Art-Tech Limited
http://nvoid.com
elburz
 
Posts: 1867
Joined: Fri Jun 01, 2012 6:55 pm
Location: Toronto, Canada

Re: Drag and Drop - Python

Postby raganmd » Thu May 28, 2015 3:00 am

elburz, you're brilliant!!

Thank you for this.

M
raganmd
 
Posts: 1058
Joined: Thu Mar 28, 2013 5:21 am
Location: San Francisco, CA

Re: Drag and Drop - Python

Postby raganmd » Sun May 31, 2015 2:27 am

raganmd
 
Posts: 1058
Joined: Thu Mar 28, 2013 5:21 am
Location: San Francisco, CA

Re: Drag and Drop - Python

Postby michela » Tue Jul 14, 2015 12:34 am

Thanks for all the above. Is there a way for the script to identify the context it was called in - e.g. id the container that called it?

Otherwise it looks like you need to have a one-to-one relationship between drop-able OP and script

EDIT - Answered my own question:
print(args) returns a list containing calling OP

('C:/Users/ModProds/Desktop/moad_video.txt', '0', '0', '0', '1', 'txt', 'moad_video', '/filebrowser/track1')
michela
 
Posts: 168
Joined: Tue Jan 10, 2012 11:51 pm
Location: Sydney


Return to TouchDesigner Documentation

Who is online

Users browsing this forum: No registered users and 1 guest