Disabling user data


#1

Hi everyone!
I’m wondering if there’s a way to gray-out some userdata when certain criteria are met…basically I would like to prevent some sliders to be edited while other switches are On). Can this be done with coffee or something else maybe ?

Thanks
Massimiliano


#2

Well, it can be done with Python. However, not very comfortable.
See this Thread on plugincafe, there is an example of how to set the limit of a userdata entry. Using the same technique you should be able to grey it out or even hide userdata.

http://www.plugincafe.com/forum/forum_posts.asp?TID=5874&KW=userdata&PID=24631#24631


#3

Hey, thanks for your advice, I’ll try to search those forums too… what i’m missing is probably how to call attributes (like hidden or disabled) for userdata. I’m trying to decript maxon SDK but sometimes its a bit off my reach :slight_smile:

thanks
m.


#4

look for a file in the resouces folder in your main c4d root folder that is called “lib_description.h.” this file will tell you what each value of a user data container does to the container(for example, hide is set to the integer 15, so by acessing the boolean contained in 15 you can hide,show the data).


#5

This is so weird.
Right now I’m working on a C++ plugin using some hide description code in it. And I noticed that this code results in the ID value of 15:

SetLong(DESC_HIDE,TRUE)

The first thing I thought was. I gotta tell this to avd007 and tell him about it. And poof here you are talking about it the same time I found it.
That’s so spooky.:slight_smile:

I don’t know if this code: DESC_HIDE, TRUE works in Python. I haven’t tried it yet.

-ScottA


#6

Hey guys, thanks for your reply!
I found that string…now its just a matter to learn how to use it :slight_smile: But basically its not a coffee or xpresso thing, Its only for python, right ?

Cheers


#7

interesting! it probably has to be something like:

SetLong(c4d.DESC_HIDE,True)

but this only works on dynamic data objects(c4d user data is dynamic). this will not work with any long value… i think. curious to try it out tho! thanks for the heads up scott!


#8

I just got a chance to test it and it works.
Here’s an example:

import c4d
from c4d import gui

def main():

	UD = op.GetUserDataContainer()		 #Get the the container for all UD entries

	for descId, container in UD:		   #Loop through all the id's in the container
	  if descId[1].id == 1:				#The specific UD you want to hide
	   if op[c4d.ID_USERDATA,1] == 0.1:	#If the UD value is set to 10%
		  container[c4d.DESC_HIDE] = True  #Set it to hidden in memory
		  op.SetUserDataContainer(descId, container) #Execute that hidden setting from memory
		  c4d.EventAdd()

if __name__=='__main__':
	main()

-ScottA


#9

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.