rendersettings copy, activate, search, delete
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/10/2012 at 02:21, xxxxxxxx wrote:
Hi Folks,
a while ago I tried to update my preview render script.
to avoid the possible but unwanted effect of changed values if render is aborted. i would like to make the changes in a dublicated version of the original rendersettings.
as I am (unfortunately) quite a newbe. and completely on my own to learn python and the c4d sdk i didnt even manage to copy a set of renderdata ;.(there are 3 things that I would like to do.
- copy a active renderdata and rename it
- search for renderdata by name and activate it
- delete a activated renderdataI would be super glad if someone could help me out.
thanks a lot
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 03:08, xxxxxxxx wrote:
ok maybe to many questions at once
so lets start with copying existing renderdata
this code doesnt work (unfortunately)
import c4d from c4d import gui #Welcome to the world of Python def main() : rd = doc.GetActiveRenderData() doc.InsertRenderDataLast(rd) c4d.EventAdd if __name__=='__main__': main()
hints are highly welcome
thanks
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 03:52, xxxxxxxx wrote:
Hi,
To copy a render data you have to call:
clone = rd.GetClone()
You can then insert the cloned render data. You cannot insert twice the same render data in a document.
To search the render datas you get the first render data with doc.GetFirstRenderData() and loop through them like objects in the document using GetNext(), GetDown() etc. Simply call rd.GetName() to get the name of a render data.
And to select a render data you have to set its active bit:
rd.SetBit(c4d.BIT_ACTIVERENDERDATA)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 04:00, xxxxxxxx wrote:
great Yannick, thanks a lot!!!!!!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 05:07, xxxxxxxx wrote:
ok so here some definitions:
but I still strugle with deleting renderdata
def RDCopyToTemp() : rd = doc.GetActiveRenderData() RDclone = rd.GetClone() #print RDclone RDclone.SetName("temp") doc.InsertRenderDataLast(RDclone) c4d.EventAdd def GetNextObject(op) : if op==None: return None if op.GetDown() : return op.GetDown() while not op.GetNext() and op.GetUp() : op = op.GetUp() return op.GetNext() def RDFindAndActivate(name) : # needs GetNextObject myRD = doc.GetFirstRenderData() if myRD==None: return while myRD: if myRD.GetName() == name: myRD.SetBit(c4d.BIT_ACTIVERENDERDATA) c4d.EventAdd myRD = GetNextObject(myRD)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 05:54, xxxxxxxx wrote:
Originally posted by xxxxxxxx
but I still strugle with deleting renderdata
To delete a render data you can call rd.Remove(). This method is defined in GeListNode (one of the parents class of RenderData).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2012 at 06:12, xxxxxxxx wrote:
thanks a lot... again
I know that starters can be nerve wrecking... sorry
all the best
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/11/2012 at 06:09, xxxxxxxx wrote:
I#m sitting once again on this project... and unfortunately again got stuck
I managed to copy the renderdata (see above) and I managed to activate it.
there are two ways it needs to be activated:- the name should be orange to indicate that i can change the values in this settings
- and the square left of the name should be white to indicate that these are the rendersettings that get used.the square can just be active with one rendersettings set at a time
but several names can be activated(orange) simutaniously.my problem:
i managed to copy the renderdata and to activate the name and the square.
unfortunately the name of the "old renderdata" is also still active(orange) so the old settings get changed (first in list) instead of the new once.I tryed:
old_rd.DelBit(c4d.BIT_ACTIVERENDERDATA)
old_rd.DelBit(c4d.BIT_ACTIVE)
c4d.EventAdd()but it didn#t work
thanks for help
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/11/2012 at 07:35, xxxxxxxx wrote:
Hi,
afaik using BaseDocument.SetActiveRenderData() automatically deactivates amy other renderdata.
Best,
Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/11/2012 at 06:36, xxxxxxxx wrote:
Hi Niklas,
well yes and no the activation dot, square or what ever you call it, that indicated the renderdata that get used is exclusiv. so there can only be one renderdata checked at a time.
but you can select mor then one renderdata to change values (indicated by the orange rendersettingsname in the list.
here is a bit of code that shows the problem:
old code (ugly)... I will change the naming... of the definitions and variablesimport c4d from c4d import gui #Welcome to the world of Python def RDCopy(name) : rd = doc.GetActiveRenderData() RDclone = rd.GetClone() #print RDclone RDclone.SetName(name) doc.InsertRenderDataLast(RDclone) c4d.EventAdd def GetNextObject(op) : if op==None: return None if op.GetDown() : return op.GetDown() while not op.GetNext() and op.GetUp() : op = op.GetUp() return op.GetNext() def RDFindAndActivate(name) : # needs GetNextObject myRD = doc.GetFirstRenderData() if myRD==None: return while myRD: if myRD.GetName() == name: doc.SetActiveRenderData(myRD) c4d.EventAdd myRD = GetNextObject(myRD) def main() : RDCopy("test") RDFindAndActivate("test") if __name__=='__main__': main()
best regards
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/11/2012 at 08:42, xxxxxxxx wrote:
I see where's the problem. Even if we set the new active render data, the old active render data is still selected (its name is in orange color).
Here's how I changed your RDFindAndActivate() function:
def RDFindAndActivate(name) : myRD = doc.GetFirstRenderData() if myRD==None: return while myRD: if myRD.GetName()==name: doc.SetActiveRenderData(myRD) c4d.EventAdd() else: myRD.SetAllBits(2) # Reverse engineered with GetAllBits(), 2 is BIT_ACTIVE but we deactivate it so use the literal value myRD = GetNextObject(myRD)
Also just a note, c4d.EventAdd() wasn't called because you just forgot the parenthesis to actually call the method.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/11/2012 at 03:19, xxxxxxxx wrote:
Hi Yannick,
thanks that works great.
one (hopefully) last questiion
if I use the RDFindAndDelete funktion with renderdata that has a child renderdata
def GetNextRObject(obj) : if obj==None: return None if obj.GetDown() : return obj.GetDown() while not obj.GetNext() and obj.GetUp() : obj = obj.GetUp() return obj.GetNext() def RDFindAndDelete(name) : myRD = doc.GetFirstRenderData() if myRD==None: return while myRD: if myRD.GetName()==name: myRD.Remove() c4d.EventAdd() myRD = GetNextRObject(myRD)
I gett a error message: Reference error: the object 'c4d.documents.RenderData' is not alive.
but the script still works as intended (at least I think so
best regards
Jops -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/11/2012 at 01:57, xxxxxxxx wrote:
Originally posted by xxxxxxxx
if I use the RDFindAndDelete funktion with renderdata that has a child renderdata
I gett a error message: Reference error: the object 'c4d.documents.RenderData' is not alive.
but the script still works as intended (at least I think so
This is because you deleted a render data that has a child render data. If you remove a parent render data, the children still references it but it's not alive anymore.
Before deleting a render data you have to make sure it has no children, removing or moving them.