@indexofrefraction I know this is not what you've asked, but it might help you:
Redshift does have a method of subdivision called screen space adaptive, which make more subdivisions on polygons that are close to the camera and less to those that are far from the camera. So it relatively lightweight because it happen only at render time and still bring good results.

Posts made by FlavioDiniz
-
RE: Plane by Python Generator
-
RE: Plane by Python Generator
@indexofrefraction I was experimenting this exactly right now!
I'm sure it's not done in the most optimized way, but it does return a beautiful quad polygon, here is:import c4d def main(): poly = c4d.PolygonObject(4,1) a = c4d.CPolygon(0,1,2,3) poly.SetPolygon(0,a) poly.SetPoint(0, c4d.Vector(0,0,0)) poly.SetPoint(1, c4d.Vector(50,0,0)) poly.SetPoint(3, c4d.Vector(0,0,-50)) poly.SetPoint(2, c4d.Vector(50,0,-50)) return poly
edit: this is just for generating a polygon, I don't know how to make parametric subdivisions on it.
-
RE: Close any C4D Window
@Cairyn said in Close any C4D Window:
That's because there is none. The Windows functionality in the API is very limited. You can open some through CallCommand but identification and handling of specific windows is not supported.
Only thing you could do is loading a new layout.
I was afraid of that answer
But thank you anyway :-) -
Close any C4D Window
Hi !
Is it possibly to close any Cinema4D window like the ones below by using python ?I've tried acessing this command, but I had no success, because I didn't find anything on the python API to get C4D windows...
Thanks!
-
RE: Shortcuts for buttons from gui.GeDialog
Thanks a lot @C4DS @m_adam !
So I think it's better to create separate CommandDataplugins to perform the same action of each button, it's less complicated and allow the user to change the keyboard shortcuts and exclude the need of the GUI being always open.Although the m_adam suggestions may be useful for other plugins ideas I have. I'll try it later.
Thanksss ! -
Shortcuts for buttons from gui.GeDialog
Hello!
I'm so happy with the C4D python API, it allows to create scripts, plugins, interfaces, menus, etc, very easily!My question is:
Is it possible to assign shortcuts to these buttons from gui.GeDialog ?
If not, I think I could achieve that by writing separate scripts to perform the same action the button does, so it appear in the customize commands window.
Thanks in advance!
Flavio
-
RE: Linking something to a handle
Sorry @a_block !
That's because I have R19 at home and R20 at the studio I work.But look the amazing result I got so far! it's almost done, I just need to test a little bit more to see if I find any bug and maybe implement some time saving utility.
Thanks again!
-
RE: Linking something to a handle
@a_block Nice!
Thanks a lot for explaining very well and for explaining the good practices when using a python tag, I used to use it wrong many times !I'll certainly try to convert this script in to a plugin, since this rig is very popular in the studio I work.
I'll post on GENERAL PROGRAMMING & PLUGIN DISCUSSIONS when its done :^)
Thanks again!
-
RE: Linking something to a handle
Thanks @fwilleke80 and @a_block :^)
Sorry if I was unclear about what my question was, maybe my question is not that appropriate to Plugincafe, since it's not too related to making a plugin, but to make a simple rig with a bend and a null object. Maybe I should have posted in C4Dcafe .. I don't knowIn short, my intention was to link the handle of a bend to a null, so I can move the null and affect the bend:
I know it's possible to do it with xpresso (in this case, the handle isn't attached to the null, but matematically in the same position... ), but I was curious if it's possible to do with python too!
thanks
-
Linking something to a handle
Python, C4D R20
Hi !
I'd like to know if it's possible to get the position of a handle from abend
ortwist
object.I fear that these handles only exists when the object is selected, if so, I don't think linking this handle to follow an object is possible... or is it ?
Thanks! -
RE: Adding items to a LONG/CYCLE description container.
hi @m_adam, thanks a lot for your answer!
I spent two days trying to implement the function in my code, but no success again :(
I think the problem now is more related to python than the C4D SDK,i'm not that experienced on it...The error i'm getting is:
AttributeError: 'testplugin' object has no attribute 'hdrs'
hdrs
is the list of strings (file paths), but seems that this list cannot be read by the GetDDescription function....
I've tried putting it as aglobal
variable, also putting undertestplugin class
, underExecute
, etc..
Tried putting theGetDDescription
andSetDParameter
as a inner function ofExecute
(I think this is wrong.. didn't give me errors, but updating the cycle doesn't work too haha).Here's the structure of my plugin, I removed some irrelevant parts so we can focus better where the error is...
Do you think the structure is correct or am I missing something ?the
.res
file is the same as in my first post.import c4d import os import sys from c4d import gui, plugins, bitmaps PLUGIN_ID = 1000001 TESTSCALE = 1001 STRINGTEST = 1003 class testplugin(plugins.TagData): def Init(self, node): tag = node data = tag.GetDataInstance() FDWhite = c4d.Vector(1,1,1) data.SetBool(FDENABLEBG, True) data.SetInt32(FDSATURATION, 100) data.SetVector(FDTINT, FDWhite) data.SetInt32(FDSAMPLES, 64) def Execute(self, tag, doc, op, bt, priority, flags): datafilename = tag.GetDataInstance() #FD Folder path path = datafilename.GetFilename(STRINGTEST) extensions = ["exr","hdr"] hdrs = [] if path != "": files = os.listdir(path) for names in files: ext = names.rsplit(".",1) if ext[1] in extensions: hdrs.append(path+'\\'+names) return c4d.EXECUTIONRESULT_OK def GetDDescription(self, node, description, flags): # Called by C4D when loading description data2 = node.GetDataInstance() if data2 is None: return False if not description.LoadDescription(node.GetType()): # Load the description return False singleID = description.GetSingleDescID() paramID = c4d.DescID(c4d.TESTSCALE) if singleID is None or paramID.IsPartOf(singleID)[0]: bcParam = description.GetParameterI(c4d.TESTSCALE) items = c4d.BaseContainer() for i, hdrs in enumerate(self.hdrs): items.SetString(i, hdrs) bcParam[c4d.DESC_CYCLE] = items return (True, flags | c4d.DESCFLAGS_DESC_LOADED) def SetDParameter(self, node, id, t_data, flags): # Called when a parameter is Set if not node: return if id[0].id == c4d.STRINGTEST: self.hdrs.append(t_data) return (True, flags | c4d.DESCFLAGS_PARAM_SET) return False if __name__ == "__main__": bmp = bitmaps.BaseBitmap() dir, file = os.path.split(__file__) bitmapfile = os.path.join(dir, "res", "icon.tif") result = bmp.InitWith(bitmapfile) plugins.RegisterTagPlugin(id=PLUGIN_ID, str="FD HDR", info=c4d.TAG_EXPRESSION|c4d.TAG_VISIBLE, g=testplugin, description="testplugin", icon=bmp)
thanks again :)
-
Adding items to a LONG/CYCLE description container.
Hi !
I'm finishing developing my first python tag plugin but there's one thing that I can't figure out how to do.... I've read the documentation and searched for some examples, but no success :(
Basically I want to add a list of string to the File
LONG CYCLE
container.
This is the part on my
.py
file where I get the strings:datafilename = tag.GetDataInstance() path = datafilename.GetFilename(STRINGTEST) extensions = ["exr","hdr","jpg","png"] c = 0 files = os.listdir(path) for names in files: ext = names.rsplit(".",1) if ext[1] in extensions: c = c + 1 lista = c lista = str(c)+';'+path+'\\'+names print lista
This is the part of my
.res
file where the cointainer is:FILENAME STRINGTEST {DIRECTORY;} LONG TESTSCALE { CYCLE { } }
I think I would be able to do this with
GetDDescription
, but I have no idea and haven't found examples in how to do it :(Does anyone know how to do it ?