CGTalk > Software > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-08-2013, 02:28 PM   #1
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
How can I assign a shortcut to the cloth tag when it's not in the commander?

Hi, I'm new here I'd appreciate your help.

I spent 10 hours trying to set a shortcut to the cloth tag, but since that command is not in the command manager I can't seem to be able to do so. Is there any way to do it?

Thank a lot!
 
Old 07-08-2013, 03:13 PM   #2
NiklasR
Expert
 
NiklasR's Avatar
portfolio
Niklas Rosenstein
Germany
 
Join Date: Jan 2011
Posts: 436
Tags are not "commands" in that sense. Though I think this would be pretty neat. You can
write a script and assign this script to a short-cut.

Code:
import c4d ID_CLOTH_TAG = 100004020 if op: tag = op.MakeTag(ID_CLOTH_TAG) doc.AddUndo(c4d.UNDOTYPE_NEW, tag) c4d.EventAdd()


Edit: Improved text.
__________________
Cinema 4D Plugin Developer
niklasrosenstein.com/ | Freebies | Plugins

Last edited by NiklasR : 07-08-2013 at 03:20 PM.
 
Old 07-08-2013, 04:09 PM   #3
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
Much much much appreciate Niklas...

That actually worked

It goes without saying, I'm a newbie, so, can you tell me how do you know the name of the cloth tag is CLOTH_TAG and the ID is 100004020? The reason I'm asking is because I've got some other tags I'd like to assign shortcuts to?

Thanks again Niklas!
 
Old 07-08-2013, 04:38 PM   #4
NiklasR
Expert
 
NiklasR's Avatar
portfolio
Niklas Rosenstein
Germany
 
Join Date: Jan 2011
Posts: 436
I have chosen the name ID_CLOTH_TAG myself. Most tags have a symbolic ID that can be accessed via the c4d module, but the cloth tag is not one of these.

Here's a script that will generate a script for you.

Code:
import re import c4d from c4d.gui import MessageDialog as MDlg TEMPLATE = """ import c4d TAG_ID = %s if op: tag = op.MakeTag(TAG_ID) doc.AddUndo(c4d.UNDOTYPE_NEW, tag) c4d.EventAdd()""" def find_symbol(type_id, expr=re.compile(r'[A-Z][a-z]+')): for k, v in vars(c4d).iteritems(): if type_id == v and expr.match(k): return k def main(): tag = doc.GetActiveTag() if not tag: MDlg('Select a single tag, please.') return # Search for the ID in the c4d module. symbol = find_symbol(tag.GetType()) if symbol is None: text = TEMPLATE % tag.GetType() else: text = TEMPLATE % 'c4d.%s' % symbol c4d.CallCommand(13957) # Clear Console print text c4d.CallCommand(12305) # Console main()


Select the tag you want to create a script for and take a look into your console.

Output for a Phong tag:

Code:
import c4d TAG_ID = c4d.Tphong if op: tag = op.MakeTag(TAG_ID) doc.AddUndo(c4d.UNDOTYPE_NEW, tag) c4d.EventAdd()


And for a rigid body tag:

Code:
import c4d TAG_ID = 180000102 if op: tag = op.MakeTag(TAG_ID) doc.AddUndo(c4d.UNDOTYPE_NEW, tag) c4d.EventAdd()



Best,
-Nik
__________________
Cinema 4D Plugin Developer
niklasrosenstein.com/ | Freebies | Plugins

Last edited by NiklasR : 07-08-2013 at 04:41 PM.
 
Old 07-08-2013, 04:47 PM   #5
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
I sincerely wish one day, I can help you with something. I'm so grateful.

You've saved me couple of restless nights.

BEST,
Trajko
 
Old 07-10-2013, 12:43 PM   #6
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
One last thing...

Hey Nik,

I was wondering if it was possible to assign a shortcut for getting into the animation layout?

Because I find myself jumping back and forth between the standard and the animation layout a lot. It would be really cool if a shortcut could be assigned.

Very best,
Trajko
 
Old 07-10-2013, 01:19 PM   #7
NiklasR
Expert
 
NiklasR's Avatar
portfolio
Niklas Rosenstein
Germany
 
Join Date: Jan 2011
Posts: 436
Hey sorovince,

sure there is. Same method: Execute the script and copy the contents of the console into a new script. The script below will ask you for a file, select the layout file *.l4d.

Code:
import os import c4d template = """ import c4d flname = r%s c4d.documents.LoadFile(flname)""" def main(): start = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_LIBRARY_USER ) flname = c4d.storage.LoadDialog(def_path=start) if not flname or not os.path.isfile(flname): return c4d.CallCommand(13957) # Clear Console print template % repr(str(flname)) c4d.CallCommand(12305) # Console... main()


Cheers,
-Nik
__________________
Cinema 4D Plugin Developer
niklasrosenstein.com/ | Freebies | Plugins
 
Old 07-11-2013, 09:15 AM   #8
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
Long live Nik

Hey Nik,

So sorry for my late reply, I wasn't able to respond. I still haven't tried that because I'm loggin from a different computer just so I can check

I have no doubt it will work.

Thanks again,

Best
Trajko
 
Old 07-11-2013, 11:51 AM   #9
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
Hey Nick,

The content of the console says...

Traceback (most recent call last):
File "'scriptmanager'", line 18, in <module>
File "'scriptmanager'", line 11, in main
NameError: global name 'os' is not defined

Am I doing something wrong?

Best,
Trajko
 
Old 07-11-2013, 12:09 PM   #10
NiklasR
Expert
 
NiklasR's Avatar
portfolio
Niklas Rosenstein
Germany
 
Join Date: Jan 2011
Posts: 436
Yup, you forgot the first line during the copy&paste.

-Nik
__________________
Cinema 4D Plugin Developer
niklasrosenstein.com/ | Freebies | Plugins
 
Old 07-11-2013, 12:24 PM   #11
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
Yup, that did it.

Best,
Trajko
 
Old 07-13-2013, 07:26 AM   #12
sorovince
New Member
portfolio
trajko
Skopje, Algeria
 
Join Date: Jul 2013
Posts: 14
Maybe this is too much but I thought it's worth the shot..

Is it possible to assign a shortcut for the a certain tab?)

For example, to select the cube, and after pressing SHIFT + C for example, to be taken to the coordinates tab as shown here...

http://dangov.com/nik.png

Best,
Trajko

Last edited by sorovince : 07-13-2013 at 08:25 AM.
 
Old 01-28-2014, 08:11 PM   #13
jackthegiantkiller
Old Member
 
jackthegiantkiller's Avatar
portfolio
Jack Myers
Animation and Design
JackMyers.tv
New York City, USA
 
Join Date: Nov 2005
Posts: 138
Quote:
Originally Posted by NiklasR
Here's a script that will generate a script for you.

Brilliant! Incredibly useful script, I can finally access tags quickly!
__________________
jackmyers.tv
 
Old 01-28-2014, 08:11 PM   #14
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:38 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.