deformer don't work when called via code

On 04/09/2016 at 23:15, xxxxxxxx wrote:

hello , 
when I call the correction deformer via this code

 corr = c4d.BaseObject(1024542) #define the correction deformer
 doc.InsertObject(corr)
 c4d.EventAdd() 

the new object don't work , when I use the CallCommand every thing work as expected .
I have tried the code above with the ben deformer and it worked as expected

any idea why this is happening ?

On 05/09/2016 at 05:45, xxxxxxxx wrote:

Hi,

some objects need some work done on initialization. Therefor MSG_MENUPREPARE is used. In the new C++ SDK Docs, there are a few more words on it in the manual about General Plugin Functionality.

For example, the Correction Deformer needs to create a Tpolygon and a Tpoint tag in there in order to be fully functional.

So to make it work your code looks like this:

corr = c4d.BaseObject(1024542) #define the correction deformer
corr.Message(c4d.MSG_MENUPREPARE)
doc.InsertObject(corr)
c4d.EventAdd() 

If you have the possibility to compile the C++ SDK examples, there's a nice little tool in there. The "Active Object Dialog". With this you can take  a look into the scene. Great for understanding object caches. And in your case, you would see the two hidden tags on the Correction Deformer, which is a good hint, that the object probably needs MSG_MENUPREPARE.

On 05/09/2016 at 08:09, xxxxxxxx wrote:

thanks for reply , 
didn't know there is a relationship between python and c++ , I will check the tool that you have mentioned 🙂
thanks again for the help