Print Page | Close Window

Sculpt Tag changes don't change dirty flags. Why?

Printed From: Plugin Cafe
Category: Plugin Cafe
Forum Name: SDK Help
Forum Discription: COFFEE, C++ and Xpresso Q&A
URL: http://www.plugincafe.com/forum/forum_posts.asp?TID=13712
Printed Date: 2018 Aug 16 at 1:34am
Software Version: Web Wiz Forums 9.61 - http://www.webwizforums.com


Topic: Sculpt Tag changes don't change dirty flags. Why?
Posted By: Aaron94
Subject: Sculpt Tag changes don't change dirty flags. Why?
Date Posted: 2017 Aug 03 at 9:43am

User Information:

Cinema 4D Version:   R17 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hi C4D,

We have Interactive Preview Render (IPR) mode which relies on dirty flags such as GetHDirty() and GetDirty() that we check for Document. If changes then we look into the hierarchy of objects. If changed (or if the order is changed) then we collect object data and send to IPR. All of this is super fast. 

But! If we attach the Sculpt Tag to some object. Then it doesn't change the values of GetHDirty() or GetDirty(). I have tested all available flags of these functions, document, objects itself, even the tag flags were tested. User changes the object with attached Sculpt Tag in Editor, but dirty flags doesn't change.

How can we automatically detect such changes? We just don't want to enter the level of data content and compare all the polygons one by one. Need flags that work well for other cases.

Best regards,
Aaron



Replies:
Posted By: Andreas Block
Date Posted: 2017 Aug 07 at 4:49am
Hi Aaron,

unfortunately there is no dirty flag or anything equivalent in order to detect sculpting changes. Sorry, regarding to development this was a deliberate decision for performance.



-------------
Cheers,
Andreas
SDK Support Engineer


Posted By: Aaron94
Date Posted: 2017 Aug 13 at 5:18am
Hi Andreas, I see. Tested everything. However, let's think about a workaround.
An idea: 
1) Collect links to objects with Sculpt Tags.
2) Detect if user is working with some Sculpt Tool like knife
3) Detect selected object.
4) Force updates on selected/active objects with Sculpt Tags

Question: is it possible to detect #2 item?


Posted By: gr4ph0s
Date Posted: 2017 Aug 13 at 8:17am
You can catch it using EVMSG_TOOLCHANGED. Then you just have to get the active doc and get the active tool.

I didn't try but maybe EVMSG_CHANGE will success for detect change.


-------------
Technical lover.


Posted By: Andreas Block
Date Posted: 2017 Aug 14 at 8:53am
@Aaron: Well, maybe you could (as gr4ph0s already suggested), but I'm afraid you will bog down sculpting performance by doing so. In the end, if I understand correctly, you are suggesting to force those updates, that were avoided in the sculpting pipeline to keep the performance high. So, if you decide to go that route, I recommend to be careful and thorough testing, especially of performance impacts.



-------------
Cheers,
Andreas
SDK Support Engineer


Posted By: Aaron94
Date Posted: 2017 Aug 14 at 11:56am
Andreas, sure you are right. It depends on the size of the object under the sculpt, and how far we can go with optimizations and what can go to background threads. One potential idea is to allow this to work automatically with all this complex coding construction if detect small polycounts. If detect too large polycounts which may slowdown the main activity then show a message attracting to click a button after huge changes.

E.g. is there any chance today to read object polygons in a background thead asynchronously? Potentially inside some critical section. Currently it's possible to do some multi-threaded process with scene launched in Main thread but we need to block it until this multi-threaded process finish the job.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.61 - http://www.webwizforums.com
Copyright ©2001-2009 Web Wiz - http://www.webwizguide.com