![]() We could less compactly poll(cls, context): More on the particular comparison “is not None” here Same family of expression as “A = B” of “A > B.” Comparisons always return True or False. Any other method could potentially return anything it wanted but we need a True or False to spit out of poll() Poll() methods of Blender operators must return True or False. Otherwise, my hammer may cause an error return context.object is not None Before I swing a hammer, I make sure that 1. Poll() determines if it is appropriate at this time, place and circumstance, to use the operator. This one is more logical to me because the what the poll() method does. In the poll method, I’m not sure why it’s there. The “cls” in this, is the method looking back at the class as an argument. They have a poll method, and that poll method is always preceded by the decorator. But all blender Operators have the same structure. i actually don’t fully understand what its for. I was hoping to see a little more progress before finishing. We can wrap this up tonight with both the ops and the Blender data methods and compare. If this script is close to what you want we might proceed to pack it in an operator.īpy.ops is certainly one way to do it, but my understanding is that the operators were giving slightly unsatisfactory results for OP. You can change them again to free alignment. # But since the automatic handles are not exactly what you want. # Thankfully they can get automatically recalculated, make sure that all of the points you want to change should be selected. # Unfortunately now the handles match the poly style (this is the problem you have). # In order the curve to change, at least one point must be activated. # Provided that your curve is POLY in the first place. I have copied these steps from the information window.īpy._type_set(type='BEZIER')īpy._type_set(type='AUTOMATIC')īpy._type_set(type='FREE_ALIGN') I can’t guess any better way to do this, if I was a math wizard I would start writing math code but the most painless way is to go as Blender would. What conditions do we want?īpy.utils.unregister_class(SimpleOperator) Selected_points = īez_point.handle_left = b_loc + l_len * l_vec.normalized()īez_point.handle_right = b_loc + r_len * r_vec.normalized()Ĭlass SimpleOperator():īl_label = "Simple Object poll(cls, context): #Find the active bezier control point bcp Whatever that is says the modeler to the animator. Here I was thinking we were talking about curve objects in the 3d view…who even knew there were curves in the F-Curve window. Now, Craig’s question is why we aren’t going any further until we get some more details. So you can read the blueprint on them too. Luckily, there are links for all these things for what Type they are. Attributes and methods.Īnything that ends with parentheses eg… do_something() is a methodĪnything that doesn’t end in parentheses is a “something”…which will be some other Type of object. If you scroll down that page, every bold item is “something” that all Curves will have or something that any Curve can do to itself or others. Ok, now let’s see what kinds of things belong to a. “Curve datablock storing curves, splines and NURBS” I don’t know if it’s the font or what, but my eyes used to skip right over the main description. Well what the heck is that? the answer is hiding right at the top of the page, but to me it’s really not obvious. ![]() But since you have described a problem where your regular operators are not performing as desired, we will probably need to dive in to the data (eg, the python Object) and modify it ourselves and make our own operator. This would me more trying to simulate operations that a user does. It tells you how its made, where it came from, what kinds of things belong to it and what it can do.Īlternatively, you can look for: bpy.ops._Category_.do_something_that_I_want() ![]() and reading what is in the Type is like, reading the blueprint or an encylcopedia about your type of object. These are python objects (not Blender objects). In general, you are looking for this bpy.Types._SOMETING_ Often, nothing will jump out, so I click around. I get those different search results in different tabs and start looking for things that make sense or seem right. ![]() Then I go to the API reference at, and search curve, segment, control point, handle which give some confusing results (any search starting out like this will). Ok, seems like there are “Segments,” “Control Points” and “Handles” So…I go to the regular wiki and checkout the curves part How are those control points and handles organized? What if there are multiple squiggles in the same object? The hardest part about tackling your first python operator is just finding out what darn data you need access to. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |