C4DLounge.eu - Cinema 4D Gebruikers Forum  

Go Back   C4DLounge.eu - Cinema 4D Gebruikers Forum > RESOURCES > Vragen >>> > Plugins & Scripts/Python/Coffee/Xpresso

Reply
 
Thread Tools Display Modes
  #1  
Old 6th June 2014
pgrooff pgrooff is offline
Moderator
 
Join Date: Aug 2009
Posts: 1,183
Default Mograph python effector

Ik heb een mograph python effector waarmee ik, als uiteindelijk resultaat, een aantal cubes will samennemen tot een object (mograph gebruikt ik om de cubes te positioneren).

Dat lijkt heel simpel:
Insert een Null met daaronder de cubes als children.
Set de Nul als SetActiveObject
Select Children
Doe een Connect Objects + Delete:

Alleen, wat ik ook doe, de Children worden niet geselecteerd!
Zie bijgaande scene voor een uitgeklede versie.

Code:
    doc.SetActiveObject(nullGroup, mode=c4d.SELECTION_NEW)
    print "Active: ", doc.GetActiveObject()

    c4d.CallCommand(100004768) # Select Children
    #c4d.CallCommand(12236) # Make Editable, not really needed
    c4d.CallCommand(16768) # Connect Objects + Delete
Attached Images
File Type: jpg mograph2.jpg (134.1 KB, 10 views)
Attached Files
File Type: c4d test scene.c4d (112.5 KB, 3 views)
Reply With Quote
  #2  
Old 6th June 2014
douwe's Avatar
douwe douwe is offline
Admin Team
 
Join Date: Feb 2010
Posts: 1,917
Default

Het is absoluut illegaal om Objecten te gaan aanmaken in runtime !!!!

d
Reply With Quote
  #3  
Old 6th June 2014
pgrooff pgrooff is offline
Moderator
 
Join Date: Aug 2009
Posts: 1,183
Default

Sorry, wat bedoel je met "in runtime".
Het moet toch mogelijk zijn objecten aan te maken, ook met een Mograph python effector?

In de bijgaande tes effector gaat het aanmaken van cubes goed.
Alleen deze met CallCommands "verder" bewerken geeft problemen.

Pim
Reply With Quote
  #4  
Old 7th June 2014
douwe's Avatar
douwe douwe is offline
Admin Team
 
Join Date: Feb 2010
Posts: 1,917
Default

at runtime = wanneer de tijdslijn loopt.

paar samples van elders :

Mikael Sterner :
Quote:
It's dangerous to use CallCommand() within an expression, since the command you call may well trigger the scene to be redrawn in which case the expressions are evaluated again. Then you will have an infinite loop, freezing CINEMA 4D.
Lennart Whlin :
Quote:
Scripting as a general term is used both in Commands -and- Expressions.
But generally, "Scripts" are Commands (not runtime), you click a button
and whatever could happen -but not in runtime- while "Play" is on.
This is where you would see people make/delete/move things in
i.e the OM hierarchy.
This is a form of modeling where you can do "whatever" and what it's meant for.

Using the same language and syntax are Expressions (i.e Tags incl xpresso)
but expressions are meant to be used runtime. This is where you cannot/should not change the OM hierarchy -other than within a GeneratorObject/Cloner/Particles-.
It is clearly expressed in the SDK.

This is why there is a "ScriptManager" (For Commands) and a "Expression Manager"
for expressions and you are generally not able to execute a
CallCommand in an Expression nor an Expression from a CallCommand.
Reply With Quote
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +2. The time now is 06:25.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Met trots gehost door Webdesign bureau Graphic Violence.
(c) C4DLounge.eu . All documents on this forum are owned by their respective creators and may not be sold or republished in any way.