Jump to content

Terrifyer

Limited Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Terrifyer

  1. Scene Nodes would probably work well if it was just a simple sliding door, but this is just a small part of a much bigger script. Its a Python Generator for a modular wall that I'll use in my work as an exhibition/ booth designer. It's almost 3k lines of code already. I have an Xpresso version of this modular wall, it works fine, but the viewport becomes very laggy when thare are to many of those and I try to move something on the screen. I tried to convert it to Scene Nodes for performance reasons, but a realized that it's something very complex to recreate this way, that's why I decided to go with python.
  2. I created a simple IK rig manually in the object manager and it works fine. It's a folding door. When I move the the goal object (g) the door opens or closes. I recreated this in a Python Generator, but when I try to move the goal via code using a slider on the interface it only moves the goal but it ignores the ik rig. def make_folding_door(width: int, hinge_side: int, opening: int) -> c4d.BaseObject(c4d.Onull): def make_cube(width: float = 15.0, height: float = 196.0, thickness: float = 1) -> c4d.BaseObject(c4d.Ocube): cube = c4d.BaseObject(c4d.Ocube) cube[c4d.PRIM_CUBE_LEN] = c4d.Vector(width, height, thickness) return cube g = c4d.BaseObject(c4d.Onull) def create_blades() -> c4d.BaseObject(c4d.Onull): root = c4d.BaseObject(c4d.Onull) root.InsertUnder(door) root[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] = 5.0 root[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] = 99.5 g.InsertUnder(root) g[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z] = -0.5 gc = make_cube(5.0) gc.InsertUnder(g) gc.SetRelPos(c4d.Vector(2.5, -0.5, 0.5)) p_1 = c4d.BaseObject(c4d.Onull) p_1.InsertUnder(root) p_1[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z] = -0.5 p_1[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X] = c4d.utils.DegToRad(-90.0) ik_tag = c4d.BaseTag(c4d.Tcaik) p_1.InsertTag(ik_tag) c_1 = make_cube(7.0) c_1.InsertUnder(p_1) c_1.SetRelPos(c4d.Vector(3.5, -0.5, 0.5)) pe = c4d.BaseObject(c4d.Onull) pe[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X] = c4d.utils.DegToRad(-180.0) ce = make_cube(7.0) ce.InsertUnder(pe) ce.SetRelPos(c4d.Vector(3.5, -0.5, -0.5)) e = c4d.BaseObject(c4d.Osphere) e[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = False e[c4d.PRIM_SPHERE_RAD] = 0.1 e.InsertUnder(pe) e.SetRelPos(c4d.Vector(7.0, 0.0, -1.0)) if width <= 1: p0 = c4d.BaseObject(c4d.Onull) p0.InsertUnder(p_1) p0.SetRelPos(c4d.Vector(7.0, 0.0, 1.0)) p0[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X] = c4d.utils.DegToRad(-180.0) c0 = make_cube() c0.InsertUnder(p0) c0.SetRelPos(c4d.Vector(7.5, -0.5, -0.5)) p1 = c4d.BaseObject(c4d.Onull) p1.InsertUnder(p0) p1.SetRelPos(c4d.Vector(15.0, 0.0, -1.0)) p1[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X] = c4d.utils.DegToRad(-180.0) c1 = make_cube() c1.InsertUnder(p1) c1.SetRelPos(c4d.Vector(7.5, -0.5, 0.5)) pe.InsertUnder(p1) pe.SetRelPos(c4d.Vector(15, 0.0, 1.0)) g[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] = 4.0 ik_tag[c4d.ID_CA_IK_TAG_TIP] = e ik_tag[c4d.ID_CA_IK_TAG_TARGET] = g return p_1 elif width == 2: return p_1 elif width == 3: return p_1 else: return p_1 blades = create_blades() g.SetRelPos(c4d.Vector(frm_w * opening, 0.0, 0.0)) return door If I make the the Python Generator editable, it recreates the hierarchy correctly with the IK tag with the 'end' and 'goal' set and the IK rig works when I move the goal. Is there anything I'm missing? PS: I know I could probably make the code shorter with a for loop, but first I want to make it step by step to make sure I'm doing everythig right.
  3. I work as an exhibition stand designer, and to make my work easier, I used Xpresso to create a tool to make aluminum profile modular walls easily. It's composed of left and right columns, which may or not have doors, and a set of center columns, which is a column without doors in a linear cloner. Each column has three sets of glass sheets, one for he bottom, one for the middle and one for the top, each one is a cloner of the glass sheet and its own spider fitting aluminum part. There are some other things that I don't need to describe here but they make everything very complex. To manage this complexity created some groups of objects, each with its own Xpresso Tag and User Data, which is controlled by its parent Xpresso until the most top level in the hierarchy. With this last one I can control a lot of things, like the total amount of columns, the width of each column, the amount and the height of glass sheets, if the left and right columns will have doors, the visibility of different parts of the wall, and a lot more. This is an screenshot of that Xpresso modular wall: It works perfectly. The Problem is that when I need to use too much of those walls in a project the performance is heavily affected and when I move some object in the view port it takes a few seconds to update. My intention is to recreate this using Scene Nodes to have a performance boost. I already started to do that, and I like the results. This is how it looks so far: The results for my performance test were great. I could use a lot of those walls, each one with many columns and many glass sheets in each part, like int the bottom, the middle and the top. The performance is very good, because it doesn't matter how much cubes or cylinders I use the create each wall it will count as one object only. The problem is that in this Scene Nodes version is just the center columns, and to recreate all the options available in the Xpresso version I'll need to use a lot more inputs and nodes, but it's already very convoluted with all these lines going from the inputs to the nodes. I'm using Node Groups to hide some of the complexity, but that doesn't seem to be enough to make things more organized because the spaghetti of lines from the input are still there. Is there any other way to make things more organized inside Scene Nodes? I'm I missing something? Should I still insist in making this with Scene Nodes, or maybe I should learn how to make it as a Python Plugin, supposing it would be possible and it would not have performance issues?
×
×
  • Create New...