On 19/07/2017 at 03:16, xxxxxxxx wrote:
Been fighting with an issue for more than a day now, maybe one of you sees the light I'm not seeing.
I've got one object with the Architectural Grass tag on it, and want to delete it from Python code.
'grassObject' is a direct link to the object in the python node in xpresso.
print (grassObject.GetTags() ) gives me in console:
[<c4d.BaseTag object called 'Grass/Architectural Grass' with ID 1028463 at 0x0000020295497E30>]
Killtag expects an int as type (asuming that is the ID I've got from the print)
Executing 'grassObject.KillTag(1028463)' crashes cinema4D. R17 as well as R18.
Anyone got a clue what I'm doing wrong?
On 19/07/2017 at 05:53, xxxxxxxx wrote:
Testing with R17 and R18 everythings work fine here.
Make sure to calle KillTag from the object and not the tag.
But you can also do
op = doc.GetActiveObject()
On 20/07/2017 at 05:34, xxxxxxxx wrote:
the actual problem is, that you try to use KillTag() from within a Xpresso Python node. That's not going to work. Xpresso Python node shouldn't delete things from the scene or create stuff therein.
On 20/07/2017 at 05:56, xxxxxxxx wrote:
Hi, Thank you for your responses!
Not a daily python developer so struggling a bit with the SDK and documentation.
I did not see anywhere that that piece of script can't be run from a xpresso node. Not did I got any warnings on it (limited compiler I guess).
Made a workaround at the moment by making an instance from the LOFT surface I want the grass to be generated on. I set it to invisible with a compositing tag so only the grass gets rendered if the instance is 'enabled'.
On 20/07/2017 at 05:59, xxxxxxxx wrote:
unfortunately our docs are lacking such notes.
Generally a Xpresso Python node shouldn't alter the scene directly, but instead just process inputs and provide results on outputs.