Thank you for the code. Very interesting and will come in handy.
"Or do you want to create a polygon that only shows the relevant part of the bitmap? The last case can be achieved by simply adapting the polygons's UV coordinates."
Yes, I want to have the bitmap with as little excess polygons around it as possible. A quad rectangle is fine as it needs to calculate fast.
Is there a python way to adapt the uv coordinates for a similar effect?
I want to get the width/height dimensions of the triangle in my bitmap in order to trim away as much alpha in my image as I can and create a polygon tight around the triangle. See Image. Basically the same function as a Trim command in photoshop. Is there an ability to do this in C4D? Maybe with GeClipMap? How would this look in code?
Thank you for any guidance here.
Thanks for the info. I'm using R19 and haven't tested on newer releases so its possible .res access to CUSTOMGUI wasn't available in R19 for RangeData...
If I can change the CUSTOMGUI's in my python file how do I do that? I have been searching around trying to find some sort of code but coming up empty handed. Handling Description ID's is pretty simple for UserData but not for an ObjectData plugin. Any code or tutorials on how I can customize my gui from my python file in my ObjectData plugin?
I am nearly done with my command data plugin but I have one final issue.
I have a RangeData Slider and I want to adjust the interface. In the .res file the only CUSTOMGUI function that is recognized is: ANIM OFF and RANGE_CURSORICON (that I can figure out)
However I need to customize the RangeData with RANGE_ALLOWRANGEEDIT and RANGE_ALLOWRANGESLELECION. See this link for the RANGE_CUSTOMGUI options available.
Can I update RANGE_ALLOWRANGESELECTION and other custom gui's in my .res file or can I do this in my .pyp file?
I am using R19
Thank you for any help.
Thank you @m_adam
worked in the Python Generator without crashing. I hope it isn't stupid to try this. I do plan on converting it to a plugin. Thanks, you can solve this question.
I have a Python Generator with an integer UserData. My code functions by adding markers based on the integer from my user data. Adding markers is working as expected. However deleting markers does not. I can't find anything in the API that deletes markers from the timeline. How would I do this? The only other option would be to delete all markers with command data. My code:
def GetMarkers(doc=c4d.documents.GetActiveDocument(), sort=True):
markers = 
thisMarker = c4d.documents.GetFirstMarker(doc)
while thisMarker is not None:
thisMarker = thisMarker.GetNext()
#Get a list of markers
markers = GetMarkers(doc)
#check if my user data integer is greater/less than the number of markers
if len(markers) < op[c4d.ID_USERDATA,1]:
c4d.documents.AddMarker(doc, None, c4d.BaseTime(len(markers)), 'name')
print 'add Marker'
elif len(markers) > op[c4d.ID_USERDATA,1]:
#Removing or del from Markers list doesnt work...
print 'delete Marker'
#Here I loop through the list and set the name,time, length, color etc. if needed
for i in range(0, len(markers)):
@m_magalhaes My aim is to create a drag and drop interface so the user can drop an object between the knots of the range slider. The range slider would represent the timeline and each knot in the range slider an in-out edit point. Drag and drop is just a cleaner way to assign edit points to an object than iterating through a link list or inExclude list.
Ok, I see, @zipit example finally got a message to work for me. (I'm still wrapping my head around the message system) Thank You Zipit.
I'm not ready to dive into C++ yet. I would love to be able to use a PyCObject but it looks as though that may be a ways off for me.
@m_magalhaes I am building an object list by dropping objects on the range slider and using the range slider's knot data to animate the object. The drag and drop would be a much cleaner way of building that list without using an InExclude or bunch of Link's.
Looks like I will just use Link for now. If you know of any sample PyCObject code I would love to have a look. Thank you for the help.
I just want to get the object data from the object that is dropped on the slider. Thats about as simple as I can say it.
It looks as though you can't pass any DRAG AND DROP message from the Range Slider.
check = op[c4d.ID_USERDATA, 1].Message(c4d.MSG_DRAGANDDROP)
Console: AttributeError: 'c4d.RangeData' object has no attribute 'Message'
but works for a link object like you said earlier.
Is there maybe a way to draw a GeUserArea with a drop area over the Range Slider?
Dragging into a BaseLink is just an example, I want to add the drag and drop freature simply for improved user experience.
How do you know this isn't an acceptable operation? I get the drop box icon as I hover over the slider data. If this isn't possible I'll abandon this topic.
Thank You Zipit, Yes, I have a range slider on a Python Generator. I made a GIF of what I'm trying to achieve.
After a user drops the object onto the range slider I want to be able to populate a link user data with the object that was dropped.
I'm trying to find information about drag and dropping an object from the hierarchy onto a Range Slider user data.
The range slider accepts dropped objects onto the user data. How would you retrieve that object after you drop it?
I am writing in python on a Python Generator.
How embarrassing I forgot to write back to the UserData. (I shouldn't code late at night) Solved.
Hello, I am using a RangeData in my UserData. I am trying to set the value of a knot in the RangeData Gui but nothing is changing despite rs.SetSelectedKnot(knot) returning True.
Is this a bug or am I doing something wrong? Thanks for any insight.
(I'm using R19)
rs = op[c4d.ID_USERDATA,1] #get my rangeSlider
v = op[c4d.ID_USERDATA,2] #Get a Float
knot = rs.GetSelectedKnot()
Thank You @m_magalhaes and @zipit
Both your suggestions were very helpful. The controller works very well @m_magalhaes I just needed to convert my user data input to BaseTime and it works perfectly.
I was able to solve the updating issue to work how I want. I only needed to add:
Now my timeline markers update nicely as I change values.
This topic can be marked solved.
I have a python generator with two integers as user data. The two integer sliders control the start and length of a timeline marker. Currently the timeline markers only update to the new integer value on mouse-up. However I would like the timeline markers to update on each value change as the user slides the integer.
How is this possible? I have been trying different messaging and event add techniques but not finding a solution. Thank You for any help.
@zipit said in Load file from plugin directory:
Amazing, that's works perfectly. Thank you!
Ok, I'm developing a tag plugin and I have specific splineData stored in a hyperfile that the tag needs to load when starting.
This works fine on my own computer:
path = os.path.join("/Applications","thedrive","Dropbox","INTERNAL","MyTag","SPLINEDATA")
but if I want to give the plugin to a co-worker or sell it how do I create the path? Am I able to put the splineData file in my plugin's /res folder and load it from there? What would that code look like?
I can't seem to find a standard python example that works for this.
Thank you for any insight.