View Full Version : how to make simple python plugin???
12-24-2012, 08:48 PM
guy's if some one knows how can i make simple python plugin based on c4d file?
because i saw some plugins very simple that consisted of ( res folder and .pype file )
and inside the res file there is just tif icon and c4d file which contains kind of preset objects and xpresso scripts
so please help guy's
12-25-2012, 09:19 AM
the very basic python plugin just consists out of one *.pyp file. the res folder is just
optional to provide some non hardcoded interface data (layout, strings, icons). you
can use *.c4d files to store preset data for your plugin, but most plugins won't do
that, beause the intended way to store presets or project data outside of the project
document is the c4d.storage.HyperFile (http://www.thirdpartyplugins.com/python_r14/modules/c4d.storage/HyperFile/index.html#c4d.storage.HyperFile) class.
there is no such thing as xpresso scripts. are you talking about xpresso script nodes ?
edit : just check out the 4d python sdk, it ships with several example plugins, of which
also one or two are single file plugins i think. there are also quite some c4d python tutorials
on the interwebs.
12-25-2012, 07:48 PM
well ok thank you so much ferdinand.......and yes i mean xpresso script nodes
ok let me ask the question in difrent way, is there a specific python script opens
a *.c4d file?
12-25-2012, 08:25 PM
i am not sure what you mean with opening. laoding a file into the editor is done by using
c4d.documents.LoadFile() which also would inculde c4d files, for loading c4d files into a
variable you would use c4d.documents.LoadDocument() which returns a c4d.documents.
BaseDocument on success.
edit : meh, the board messed up the example code again, i have posted it on pastebin.
12-25-2012, 09:32 PM
well thank you again ferdinand
but to get to the point please take a look to the linked file
and thats what i want i want to make plugin from a *.c4d file
the same in the linked file
and put it in plugins folder of cinema 4d
and use it normaly as the other plugins
simple python just put it in plugins folder.zip (http://wikisend.com/download/113166/simple python just put it in plugins folder.zip)
12-25-2012, 11:04 PM
you just want to load an object or a list of objects from an external file into the current
document. you could either use c4d.documents.LoadDocument() as stated in the my
previous posting and iterate your way through the document to get the data you need
or you could just merge the 'preset' file with your document using the
if it has really to be a plugin over a script you would have to write a class derived
from c4d.plugins.ObjectData and overwrite the method ObjectData.GetVirtualObjects().
you could load the 'preset' data on plugin init and then store the found BaseObjects
as members of your plugin class and return them with GetVirtualObjects().
for more informations how to write plugins read the sdk. informations about
plugins.ObjectData and its overwriteable methods can be found here (http://www.thirdpartyplugins.com/python_r14/modules/c4d.plugins/BaseData/NodeData/ObjectData/index.html#ObjectData.GetVirtualObjects) .
ps : i haven't checked the file, because i have no c4d here. you ould also use some other
plugin classes, but they would make even less sense. i would go for a script. fast and easy.
and for the user not distinguishable, as scripts can also sit with their own icon in a toolbar.
12-25-2012, 11:21 PM
ok thank you so so much ferdinand
i realy appreciate yor help thank you mate
i will try with your solution and see what will happen
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.