Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Probably there is a better way but you can try this method
selectionTag = op.GetTag(5673) c4d.CallButton(selectionTag , c4d.POLYGONSELECTIONTAG_COMMAND3)
I'm such an idiot Seems like the same code can be applied to user-defined descriptions. SOLVED!
@mikeudin We all have to learn C++
I guess you want to create a node of the node.
Hello PluginCafe!
I'm trying to display object points via the tag plugin. The code worked fine in older versions of C4D but it has no effect in the latest versions. Am I doing anything wrong?
def Draw(self, tag, op, bd, bh): bd.SetPen( c4d.Vector(1)) bd.SetPointSize( 3 ) bd.SetMatrix_Screen() bd.SetDepth(True) objMg = op.GetMg() #Get the world (global) matrix ptList = op.GetCache().GetAllPoints() points = [objMg * p for p in ptList] # Retrieves Global Coordinates screenPoints = [ bd.WS(p) for p in points ] # From world to screen Coordinates (in another array) bd.DrawPoints(screenPoints, vc = None, colcnt=1, vn=None) return c4d.DRAWRESULT_OK
Code:
import c4d, urllib2, os url = r"https://www.patreon.com/posts/24993001" f = os.path.join(os.path.dirname(c4d.storage.GeGetStartupApplication()), "resource", "ssl", "cacert.pem") urllib2.urlopen(url, cafile=f)
Error:
Traceback (most recent call last): File "scriptmanager", line 7, in <module> File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 435, in open response = meth(req, response) File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 473, in error return self._call_chain(*args) File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 403: Forbidden
urllib2 no longer has any effect in Cinema 4D. It is worth mentioning that I did not change anything in my code. It was working like a charm. I doubt the latest windows update corrupted it. Are there any solutions to bypass this limitation?
Traceback (most recent call last): File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\symex.pyp", line 74, in <module> check.UpdateAtStartUp(version, url, command = 1051407,) File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\res\modules\checkUpdate.py", line 171, in UpdateAtStartUp if NewVersion(version, url,)[0]: File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\res\modules\checkUpdate.py", line 68, in NewVersion htmlsource = urllib2.urlopen(url, cafile=f) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 435, in open response = meth(req, response) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 473, in error return self._call_chain(*args) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 403: Forbidden
OK. Now I get it.
Thank you very much! I really appreciate what you've done.
Have a good day!
-Merk
OMG! You just wrote the entire plugin for my silly question. Thank You!!!
I have only one question. Why did you use Draw(self, op, drawpass, bd, bh) instead of Draw(self, tag, op, bd, bh) will not drawpass be treated as op and op as a tag?
Draw(self, op, drawpass, bd, bh)
Draw(self, tag, op, bd, bh)
drawpass
op
tag
The method above causes shading problems which can be solved by enabling depth option. bd.SetDepth(True)
bd.SetDepth(True)
But it's still displayed on the background. Is it possible to bring it to the front?
Seems like I figured this out but it's kinda complicated.
def Draw(self, tag, op, bd, bh): values0 = [{'_txt': "Hello", "_position": v(100,100,0)},{'_txt': "World", "_position": v(200,200,0)}] bd.DrawMultipleHUDText(values0) return c4d.DRAWRESULT_OK
I want to display these values on top of other viewport elements.
I'm using Draw() method if TagData plugin for displaying multiple text values but I can't figure out, how the DrawMultipleHUDText works.
Let's assume I have a list of strings abc = [ "Hello", "World", ]
abc = [ "Hello", "World", ]
And a list of vectors (Usually I'm importing c4d.Vector as v) xyz = [v(0,100,0), v(0,200,0)]
xyz = [v(0,100,0), v(0,200,0)]
How should I pass them into DrawMultipleHUDText?
I tried this method and it does not work.
def Draw(self, tag, op, bd, bh): abc = ["Hello", "World"] xyz = [v(0, 100, 0), v(0, 200, 0)] values = {'_txt': abc, "_position": xyz} bd.DrawMultipleHUDText(values) return c4d.DRAWRESULT_OK
Thanks, Manuel!
Don't spend more time on this. I already know about "brute force" methods, so I probably will use it in my code.
I'm making a free, open-source spline object plugin which will contain spline object properties.
Its Angle, Number, and Maximum Length values are ghosted according to the Interpolation Points value. I do not want to mislead people and use complicated snippets in my code, but if this is the only way, then I will INCLUDE spline data in the .res file which can be ghosted directly from .pyp file via GetDEnabling
INCLUDE
.res
.pyp
GetDEnabling
def GetDEnabling(self, node, id, t_data, flags, itemdesc): spline_type = node[c4d.SPLINEOBJECT_INTERPOLATION] if spline_type == 0: ghost1,ghost2,ghost3 = False, False, False elif spline_type == 1: ghost1,ghost2,ghost3 = True , False, False elif spline_type == 2: ghost1,ghost2,ghost3 = True , False, False elif spline_type == 3: ghost1,ghost2,ghost3 = False, True , False elif spline_type == 4: ghost1,ghost2,ghost3 = False, True , True if id[0].id == c4d.SPLINEOBJECT_SUB: return ghost1 if id[0].id == c4d.SPLINEOBJECT_ANGLE: return ghost2 if id[0].id == c4d.SPLINEOBJECT_MAXIMUMLENGTH: return ghost3 return True