Move object out of cloner [SOLVED]
-
On 22/12/2014 at 14:26, xxxxxxxx wrote:
Is it possible using Python to move an object out of a cloner hierarchy and back in again with user data? I can't seem to figure out how to do this. Any help would be appreciated. Thanks.
-
On 23/12/2014 at 04:33, xxxxxxxx wrote:
You can use an Instance Object.
-
On 23/12/2014 at 04:38, xxxxxxxx wrote:
Hello,
you can move an object in the hierarchy by simply making it a child of another parent object using
InsertUnder()
[URL-REMOVED]. What exactly do you mean with "with user data"?Best wishes,
Sebastian
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 23/12/2014 at 05:50, xxxxxxxx wrote:
I figured it out. Thanks.
import c4d
Dan Couto Move Light Instances 2014
numerical_types = (c4d.ID_GV_VALUE_TYPE_BOOL)
def main() :
doc = c4d.documents.GetActiveDocument()
xmaslights = doc.SearchObject('Xmas Lights 2.0 Controller')
star_switch = xmaslights[c4d.ID_USERDATA,20]
retro_switch = xmaslights[c4d.ID_USERDATA,28]
ping_switch = xmaslights[c4d.ID_USERDATA,29]
pinecone_switch = xmaslights[c4d.ID_USERDATA,30]
snoglobe_switch = xmaslights[c4d.ID_USERDATA,31]
star_bulb = doc.SearchObject('Star bulb')
retro_bulb = doc.SearchObject('Retro bulb')
ping_bulb = doc.SearchObject('Ping bulb')
pinecone_bulb = doc.SearchObject('Pine Cone bulb')
snoglobe_bulb = doc.SearchObject('Sno Globe bulb')
bulb_cloner = doc.SearchObject('bulb Cloner')
bulb_group = doc.SearchObject('Bulb Group')
if star_switch == 1:
star_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1
star_bulb.InsertUnder(bulb_cloner)
else:
star_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0
star_bulb.InsertUnder(bulb_group)
if retro_switch == 1:
retro_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1
retro_bulb.InsertUnder(bulb_cloner)
else:
retro_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0
retro_bulb.InsertUnder(bulb_group)
if ping_switch == 1:
ping_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1
ping_bulb.InsertUnder(bulb_cloner)
else:
ping_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0
ping_bulb.InsertUnder(bulb_group)
if pinecone_switch == 1:
pinecone_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1
pinecone_bulb.InsertUnder(bulb_cloner)
else:
pinecone_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0
pinecone_bulb.InsertUnder(bulb_group)
if snoglobe_switch == 1:
snoglobe_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1
snoglobe_bulb.InsertUnder(bulb_cloner)
else:
snoglobe_bulb[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0
snoglobe_bulb.InsertUnder(bulb_group)
print "star_bulb"""" If star_switch == 1, check to see if Star bulb is already under the bulb Cloner.
If it is, leave it there.
If not, put it under the bulb Cloner.
If star_switch == 0, check to see if Star bulb is already under bulb Cloner.
If it is, move it out of the hierarchy.
If it is not under bulb Cloner, do nothing.Same for the other 4."""