Folding an object in the Object Manager
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2012 at 18:38, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Mac OSX ;
Language(s) : PYTHON ;---------
I'm trying to force the folding of an object with children, in the Object Manager.
I tried it in COFFEE and it didn't work.
Now I was trying to do it in Python and it seems that it doesn't work either
I tried with:op.SetBit(BIT_OFOLD)
and with
op.SetBit(NBIT_OM1_FOLD)
But nothing happens. Is it also not possible with Python?
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 00:25, xxxxxxxx wrote:
Have You tried 'GeListNode.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)' in Python?
Cheers
Peter -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 03:28, xxxxxxxx wrote:
How should I apply it?
Like this?op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)
If it is, it is still not working
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 03:54, xxxxxxxx wrote:
It's necessary to inform the manager about the update with an EventAdd().
Toggles the fold state:
op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_TOGGLE) op.Message(c4d.MSG_CHANGE) c4d.EventAdd()
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 04:21, xxxxxxxx wrote:
Well, what I'm trying to achieve is an object that folds itself as soon as an object is dropped in or outside it.
For that, I created a Python Generator with the following code:old_childs=0 import c4d #Welcome to the world of Python def main() : global old_childs childs=0 current=op.GetDown() if current is None: return while current is not None: childs=childs+1 current=current.GetNext() if childs==old_childs: return old_childs=childs op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET) op.Message(c4d.MSG_CHANGE) c4d.EventAdd() return c4d.BaseObject(c4d.Onull)
But it is not working. Could it be because the object is trying to fold itself?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 05:23, xxxxxxxx wrote:
A bit confusing, but the clear bit folds the object.
Example for Python generator:
import c4d #Welcome to the world of Python def main() : op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_CLEAR) op.Message(c4d.MSG_CHANGE) c4d.EventAdd() return c4d.BaseObject(c4d.Ocube)
Personally I think it's not a good idea to do and I'm not sure if it's thread safe etc.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 05:37, xxxxxxxx wrote:
Weird!! I would assume that to fold we would need to SET the bit.
This is for a Vault object - I would place in it objects that I want to keep but that I currently don't need.
It will only fold when objects are added or removed from it. But I can still fold/unfold it manually.
Thank you very much for your help, Matthias.Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2012 at 05:57, xxxxxxxx wrote:
This should work in an Python Expression Tag.
Let me know.
Should you need to do this via a Command script,
you would need to store the childcount in the parent object
itself, using a unique ID from PlugIn Cafe'.Cheers
Lennartimport c4d childcountmemo = 0 def main() : global childcountmemo obj = op.GetObject() obj[c4d.TPYTHON_RESET] = False # Turn off 'Reset on Frame 0' obj[c4d.TPYTHON_FRAME] = False # and 'Frame Dependent' childcount = len(obj.GetChildren()) if childcount != childcountmemo and obj.GetNBit(c4d.NBIT_OM1_FOLD) : obj.ChangeNBit(c4d.NBIT_OM1_FOLD,c4d.NBITCONTROL_CLEAR) childcountmemo = childcount