@m_adam said in [python] SetFont not working:
In which version are you? The code I posted is working nicely in R20.059.
20.059. Before i tried any methods, that's my fail. Not work for me. From new start of c4d. - it works
@m_adam said in [python] SetFont not working:
In which version are you? The code I posted is working nicely in R20.059.
20.059. Before i tried any methods, that's my fail. Not work for me. From new start of c4d. - it works
Hello Maxime
Thank you.
I tried such form and can not get it work. I think i'm "messing"(replace FontData to BaseContainer) data for GUI, so it does not work for me.
Found such solution:
import c4d
def main():
bc = c4d.BaseContainer()
ids = c4d.PRIM_TEXT_FONT
#ids = c4d.DescID(c4d.DescLevel(2117,1009372,5178))
op.SetParameter(ids, bc, c4d.DESCFLAGS_SET_0)
bc.SetString(500, 'Arial')
bc.SetString(501, '11')
bc.SetInt32(502, 400)
bc.SetInt32(503, 0)
bc.SetString(509, 'Arial')
bc.SetString(508, 'ArialMT')
new_fd = c4d.FontData()
new_fd.SetFont(bc)
op.SetParameter(ids, new_fd, c4d.DESCFLAGS_SET_0)
c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_FORCE_AM_UPDATE))
c4d.gui.GeUpdateUI()
c4d.EventAdd()
# Execute main()
if __name__=='__main__':
main()
Hello
C4D version: 20.059
OS: Windows 10
I select motext and try to change font(fontdata) for text by script
import c4d
from c4d import plugins
def main() :
bc = c4d.BaseContainer()
bc.SetString(500, 'Arial')
bc.SetString(501, '11')
bc.SetInt32(502, 400)
bc.SetInt32(503, 0)
bc.SetString(509, 'Arial')
bc.SetString(508, 'ArialMT')
# select mograph text
op[c4d.PRIM_TEXT_FONT].SetFont(bc)
op.Message(c4d.MSG_CHANGE)
c4d.EventAdd()
if __name__=='__main__':
main()
can not get it work
After acquisition of Redshift, i hope we get node material system v.2 and sdk for it.
Aaron, i think it will be closed work in progress. I read about it from blog at maxon
Andreas thank you! You need new pool for fish
Welcome, Manuel! xplode them all !!!
Hello
Same here for python. Even check by AddPortIsOK(), says True, not adding
I also test c++ code, it adds to object operator(like topic master wants) but does not to nodemaster and no connect
{
BaseDocument *doc = GetActiveDocument();
BaseObject *obj = (BaseObject *) doc->GetActiveObject();
if(!obj) return FALSE;
XPressoTag *xTag = (XPressoTag*)obj->GetTag(Texpresso, 0);
if(!xTag) return FALSE;
GvNodeMaster *nm = xTag->GetNodeMaster();
GvNode *n1 = nm->GetRoot();
GvPort *p1;
if (n1->AddPortIsOK(GV_PORT_OUTPUT,40000002))
{
p1 = n1->AddPort(GV_PORT_OUTPUT, 40000002, GV_PORT_FLAG_IS_VISIBLE, TRUE);
print("True");
}
else
{
print("False");
}
GvPort *p3 = n1->AddPort(GV_PORT_OUTPUT, 536870935, GV_PORT_FLAG_IS_VISIBLE, TRUE);
GvNode *n2 = nm->CreateNode(nm->GetRoot(), ID_OPERATOR_OBJECT, NULL, 0, 0);
GvPort *p2 = n2->AddPort(GV_PORT_OUTPUT, 40000002, GV_PORT_FLAG_IS_VISIBLE, TRUE);
if (p1 && p2)
{
GvNode *n1u = NULL;
GvNode *n2u = NULL;
GvPort *p1u = NULL;
GvPort *p2u = NULL;
if (nm->IsConnectionValid(n1, p1, n2, p2, n1u, p1u, n2u, p2u))
{
n2->AddConnection(n1, p1, n2, p2);
}
}
n1->Message(MSG_UPDATE);
n2->Message(MSG_UPDATE);
nm->Message(MSG_UPDATE);
EventAdd();
}
Hello
I read manual, repeat with sdk (zip file), compile succesfully and start thinking about author of tool. I'm fan of Niklas Rosenstein and his craftr. New tool reminds me craftr.
Thanks a'lot for tool!