Smart PolyChart Cinema 4D Plugin – fun with the UserArea 

2012-07-12 00:06 发布 | 作品版权归原作者所有,仅供参考学习,禁止商业使用!

836 3 0
Smart PolyChart Cinema 4D Plugin – fun with the UserArea - C4D之家 - sa_copy1.ekeje4pv6x46wwcg8kgsco8co.ekdjdxruf9hlgcskw0cwk4c8s.th.jpeg
Smart PolyChart is a simple CommandData plugin which draws a neat bar chart from the polygon counts of all polygon objects in a scene.
You can download it here – the source is documented.


The part for users:
Just drag it into your /Plugins folder and open it from the ‘Plugins’ menu. The ‘Update’ button refreshes the view, a click on a column will select the corresponding object so you can optimize or remove it to lower the scenes polygon count.



  
  

   

      
      

        
        
          Download(C8D)
        
      


      

        
      
      

      
      
      

      
      
      
   

  

  
  
  




The part for coders:
Why another CommandData Plugin? Well, I thought this one might actually be helpful for some users and a great excuse to have a little fun with the UserArea.
The UserArea is a Gadget that allows you to draw bitmaps, lines, etc. onto a canvas – and lets the user interact with them.
Since the previous post completed the little ‘advanced python plugin coding trilogy’ with a CommandData plugin, I don’t have to go into too much detail about the projects structure.
Just a quick note about the ‘worker.py’ – the code in that file just recourses through the documents to find all polygon type objects and return a list of them.
Ii could well have been a part of the ‘maindialog.py’ or the ‘canvas.py’ itself – but same as with the previous plugin, I kept it speparate.
Only a reminder that not everything has to be a class or included within the classes you extend from the Cinema4D API.
Smart PolyChart Cinema 4D Plugin – fun with the UserArea - C4D之家 - 0.jpg
If you take a look at the ‘canvas.py’ and already have some 2D-drawing experience, you’ll find it pretty straight forward.
Just remember to set the clipping region to the area of the canvas you currently want to draw in.
Redrawing the whole canvas for every update is a bad practice – at least if you want to frequently update or even animate something.
Due to the nature of the graphic the plugin produces (a bunch of bars most times filling the complete ‘screen’ or workspace), there is little to be gained here by calling SetClippingRegion() – but it’s still used to keep the text elements from overlapping the outlines.
Still, it’s a good habit to look for parts of the canvas you can just leave alone in a following update – clip and re-draw only what needs to be changed.
The source also holds a little example on how to handle mouse events within a UserArea – keep in mind that the mouse coordinates need to be offset by the position of the gadget on the screen.

return
Trying to keep it short this time… – hope you have fun coding!

B Color Smilies

Comment :3

百套精美Kitbash3D模型专题合集下载
时尚卡通办公室人物C4D立体图标工程下载Cinema 4D Fashion Cartoon Office Character 3D Icon Project Download
C4D科技新闻片头电视栏目频道包装动画工程下载Cinema 4D Technology News Headline TV Program Channel Packaging Animation Project Download
关闭

C4D精选推荐 7/10

340.7GB灰猩猩Greyscalegorilla模型材质贴图素材合集
340.7GB灰猩猩Greyscalegorilla模型材质贴图素材合集
Greyscalegorilla Plus Mega Archive 是一套庞大的资源合集,旨在为 Cinema 4D 用户提供丰富的材质、纹理、模型等资源,从而加速创作流程并提升作品质量。该合集分为两部分,第一部分(Part 1)专注于材质,第二部分(Part 2)则包含了更广泛的资源,包括材质、纹理、Gobo(遮光片)、Bokeh(散景)以及大量的 3D 模型。
智能
客服
快速回复 返回顶部 返回列表