Script Log ?? Softimage Script Editor

On 20/08/2013 at 14:17, xxxxxxxx wrote:

Hello,
I want know what is (Alt+AddNull on object = Null become parent) in python, because i want create a batch of Null parent of 200 obj.

I didn't find in the python docs, only a myobject.InsertUnder(). but i want create a Null parent.

In a Script Log, when i do the command, it's write : c4d.CallCommand(5140) # Null
What its mean ?
I want see the FULL code not a command number.

In Softimage the script editor is really friendly.
Every action are wrote on the window, so it's really easy to create a macro script.

Someone knows where i could see this in C4D ?

On 20/08/2013 at 17:37, xxxxxxxx wrote:

import c4d
  
def main() :
    null = c4d.BaseList2D(c4d.Onull)
    select = doc.GetActiveObject() or doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
    if isinstance(select, c4d.BaseObject) :
        prev = select.GetPred()
        next = select.GetNext()
        parent = select.GetUp()
        select.Remove()
        select.InsertUnderLast(null)
        if prev is not None:
            null.InsertAfter(prev)
        elif next is not None:
            null.InsertBefore(next)
        elif parent is not None:
            null.InsertUnderLast(parent)
        else:
            doc.InsertObject(null)
    elif isinstance (select, list) and len(select) > 0:
        inspnt = select[0].GetPred()
        for obj in select:
            obj.Remove()
            obj.InsertUnderLast(null)
        doc.InsertObject(null, pred=inspnt)
    null.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)
    c4d.EventAdd()
  
if __name__=='__main__':
    main()

On 23/08/2013 at 08:50, xxxxxxxx wrote:

Thank you littledevil !

Someone can explain to me, why the Script Log don't show the real code ? only command code ?

On 23/08/2013 at 09:47, xxxxxxxx wrote:

CallCommand() is real code. c4d.callCommand() is a normal method in the c4d API. C4D is much
more OO than Softimage XSI, everything is an object with its own methods and so on. C4d does 
not use a central hub like XSI (XSIFactory.DoSoemthingMehtod(parameter)) you can easily feed 
from a script parser.

On 23/08/2013 at 12:19, xxxxxxxx wrote:

Ok,
Do you know, where i can find the list of all the c4d.CallCommand(????) and the detail for each ?
I read the Python SDK Docs, (but nothing here).
Thank

On 23/08/2013 at 12:40, xxxxxxxx wrote:

sure it is documented, right there in the c4d module. but you won't find a very extensive 
description there, as maxon expects you to either use a text search engine on the c4d 
resource folder or the c4d console to find IDs.

On 23/08/2013 at 13:30, xxxxxxxx wrote:

Ooh i try many time the research engine, but it don't work with chrome... only firefox rocks !

On 23/08/2013 at 16:16, xxxxxxxx wrote:

with text search engine i meant a software like Agent Ransack.

On 26/08/2013 at 13:34, xxxxxxxx wrote:

Finally, i find the way to finish my little script :

import c4d

def main() :
    select = doc.GetActiveObject() or doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_0)
    Nselect = len(select)
    for i in range(Nselect) :
        pos = c4d.BaseObject.GetAbsPos(select _)   # Get position objects
        obj = c4d.BaseObject(c4d.Onull)             # Create new nulls
        obj.SetAbsPos(pos)                          # Set position of nulls
        doc.InsertObject(obj)                       # Insert objects in document
        select _.SetAbsPos(c4d.Vector(0))          # Reset objects position to 0
        select _.InsertUnder(obj)                  # Set nulls parent of objects
    
    c4d.EventAdd()

if __name__=='__main__':
    main()

It's helpful with Fracture moggraph, it's for keep axis pivot the same.

But i continue to think than have the option to see Script log like :
c4d.DoSomething.Method(parameter)
Will help people to understand what they write, and create script easier.