Jump to content

graphos

Maxon
  • Posts

    102
  • Joined

  • Last visited

Everything posted by graphos

  1. Make sure to have the frame independant option checked into the python node.
  2. Good job, it's always nice to see matrice math :p
  3. If I understand right you want target expression?
  4. myVec = c4d.Vector(0, 0, 0) #X, Y, Z #get globl matrice mg = myObj.GetMg() #set the world position to my vector mg.off = myVec #set the matrice of the obj myObj.SetMg(mg) #trigger c4d update c4d.EventAdd() I guess something like that?
  5. Not sure But I guess it's something like octave. So like that I will say the result of the current noise value used to determine next level. Basicly let's assume you have function Noise(seed) just make Noise(Noise(Seed)) But I'm not sure but it's what it's looking.
  6. Ok get it to work. Even if it's not what I call realtime. It's work(take care it can easily crash your c4d :p) It will be more usefull to bake all frame and then do a script wich set the picture in the displacer for the current given frame. Bake.c4d
  7. I guess it's that you want. (But I'm not sure ^^') A shuffle from a seed Just change the seed value for another result :) SHUFFLE.c4d
  8. Make an empty polygon. Select the move tool. GO to point mode. Make sure to have nothing selected. Ctrl click Create a point. Activate polygon snaping, add mograph in object mode into this point cloud and you get the perfect tool for placement stuff ! It can be boring to find which point id is selected. Select a point => Select move tool => Alt + double click on the point. And you get a little windows with the point id and the point position.
  9. And http://www.plugincafe.com/forum/forum_posts.asp?TID=13473&PID=53497#53497 if you want to restore after ;)
  10. It's way more complicated than he seem to be. And I doubt you will do it but here it's how I would build it if I have to do it. In python you have to split thing since you can't use CallButton in a Tag, So you have to execute your code in the main thread: Register a tag who will store in his basecontainer the actual state. Register a MessageData plugin. Who will check all the scene for this tag and then act on the scene. In C++ Since you have directly acces to the weightData you can do it in your tagData. But since it's not thread safe it might be crash (I never really tested)
  11. import c4d import tempfile import os def main(): lightGroup = op[c4d.ID_USERDATA,1] targetTex = op[c4d.ID_USERDATA,2] targetUVW = op[c4d.ID_USERDATA,4] targetDisp = op[c4d.ID_USERDATA,5] lights = [] lightList = lightGroup.GetChildren() for idx in range(len(lightList)): item = lightList[idx] if item[c4d.LIGHT_TYPE] == 1: lights.append(item) illumBMP = c4d.bitmaps.BaseBitmap() tmp = illumBMP.Init(512, 512, 24, 0) #make sur to init a width/height bc = c4d.BaseContainer() bc[c4d.BAKE_TEX_COLOR] = True bc[c4d.BAKE_TEX_COLOR_ILLUM] = True bc[c4d.BAKE_TEX_NO_INIT_BITMAP] = True bc[c4d.BAKE_TEX_WIDTH] = True bc[c4d.BAKE_TEX_HEIGHT] = True #since we are un a tag init it with the tag' thread thread = c4d.threading.GeGetCurrentThread() ibt = c4d.utils.InitBakeTexture(doc, targetTex, targetUVW, targetUVW, bc, thread) #Check if something went wrong if ibt[1] != c4d.BAKE_TEX_ERR_NONE: print ibt return #Assign the new render doc render_doc = ibt[0] bt = c4d.utils.BakeTexture(render_doc, bc, illumBMP, thread, None) #Check if something went wrong if bt != c4d.BAKE_TEX_ERR_NONE: print bt return #save our baked image to somewhere: f_path = os.path.join(tempfile.gettempdir(),"realTimeIllumBake_buffer_picture.jpg") illumBMP.Save(f_path, c4d.FILTER_JPG) #Set layer to the bmp layer_sha = targetDisp[c4d.ID_MG_SHADER_SHADER] first_sha_layer = layer_sha.GetFirstLayer() shader = first_sha_layer.GetParameter(c4d.LAYER_S_PARAM_SHADER_LINK) shader[c4d.BITMAPSHADER_FILENAME] = f_path How do you manage to get the illumination into the vertex map? :) Btw even if there is no more error I didn't succes to have a working bake. It's always black. Maybe consider contacting guys at plugincafe ;)
  12. Here a working example. import c4d def main(): obj = doc.SearchObject("Plan") if not obj: return selection_name = "MySelection" selection_tag = None #Get the first segment selectionTag named by MySelection for tag in obj.GetTags(): if tag.CheckType(5701) and tag.GetName() == selection_name: selection_tag = tag break if not selection_tag: return save_mode = doc.GetMode() save_tool = doc.GetAction() #Set To edge mdoe doc.SetMode(c4d.Medges) #Get selected edge bs = obj.GetEdgeS() bs_copy = bs.GetClone() #for retrieve it later bs.DeselectAll() #deselect all currently selected edge #Select all edge from tag c4d.CallButton(selection_tag, c4d.EDGESELECTIONTAG_COMMAND3) #Set the weight c4d.CallCommand(1007573) tool = c4d.plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) tool[c4d.MDATA_SDSWEIGHT_MODE] = 0 tool[c4d.MDATA_SDSWEIGHT_STRENGTH] = 1 c4d.CallButton(tool ,c4d.MDATA_SDSWEIGTH_SETSTRENGTH) #reset edge selection bs_copy.CopyTo(obj.GetEdgeS()) #reset doc doc.SetAction(save_tool) doc.SetMode(save_mode) #trigger c4d update c4d.EventAdd() if __name__=='__main__': main()
  13. You can't use CallButon in a tag. Because It's how c4d works. For more informations https://developers.MAXON.net/docs/Cinema4DPythonSDK/html/modules/c4d.threading/index.html#threading-information Basicly when you make python code into a tag it's executed into TagData.Execute(). And CallButton add an Event and create Undo so you can't use it into this context.
  14. Here a script for doing what you want to achieve. Get the gobal pos / global Scale / global Rot of both then do the average then set global pos/scale/rot. Scale and rotation are hardly linked in matrice so it's why it's can look weird. But explode each copound and rebuild one after should work. import c4d def GetGlobalPosition(obj): return obj.GetMg().off def GetGlobalRotation(obj): return c4d.utils.MatrixToHPB(obj.GetMg()) def GetGlobalScale(obj): m = obj.GetMg() return c4d.Vector( m.v1.GetLength(), m.v2.GetLength(), m.v3.GetLength()) def SetGlobalPosition(obj, pos): m = obj.GetMg() m.off = pos doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj) obj.SetMg(m) def SetGlobalRotation(obj, rot): m = obj.GetMg() pos = m.off scale = c4d.Vector( m.v1.GetLength(), m.v2.GetLength(), m.v3.GetLength()) m = c4d.utils.HPBToMatrix(rot) m.off = pos m.v1 = m.v1.GetNormalized() * scale.x m.v2 = m.v2.GetNormalized() * scale.y m.v3 = m.v3.GetNormalized() * scale.z doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj) obj.SetMg(m) def SetGlobalScale(obj, scale): m = obj.GetMg() m.v1 = m.v1.GetNormalized() * scale.x m.v2 = m.v2.GetNormalized() * scale.y m.v3 = m.v3.GetNormalized() * scale.z doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj) obj.SetMg(m) def main(): a = doc.SearchObject("A") b = doc.SearchObject("B") x = doc.SearchObject("X") #Check if we found objs if not a or not b or not x: return #get pos a_pos = GetGlobalPosition(a) b_pos = GetGlobalPosition(b) #get scale a_scale = GetGlobalScale(a) b_scale = GetGlobalScale(b) #get rot a_rot = GetGlobalRotation(a) b_rot = GetGlobalRotation(b) #calculate average average_pos = (a_pos + b_pos) / 2 average_scale = (a_scale + b_scale) / 2 average_rot = (a_rot + b_rot) / 2 #Set data doc.StartUndo() SetGlobalPosition(x, average_pos) SetGlobalScale(x, average_scale) SetGlobalRotation(x, average_rot) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main()
  15. You can't do CallButon into a python tag. But use the code provided in the file instead (Enven if it's not recomanded to change the scene in a tag you could do it :)) CallButtonIssue.c4d
  16. Why not make a tag into this object #op = current so in a tag context op = the tag op.GetObject() #return the object What you really want to do because it's seem obscure. Basicly you want to have a script (who run only when you press a button?) who act on the selected object and do => Restore Selection into edge selection tag?
  17. import c4d def main(): #Check if we got something selected if not op: return #Search for the target targetObj = doc.SearchObject("Cube") #Check if we got any objs if not targetObj: return #Launch the Transfer tool c4d.CallCommand(c4d.ID_MODELING_TRANSFER_TOOL) tool = c4d.plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) if tool is not None: #Assign the target object tool[c4d.MDATA_TRANSFER_OBJECT_LINK] = targetObj c4d.CallButton(tool, c4d.MDATA_APPLY) c4d.EventAdd() if __name__=='__main__': main()
  18. import c4d def main(): bbb = doc.SearchObject("B") aaa = doc.SearchObject("A") xxx = doc.SearchObject("X") bMG = bbb.GetMg() aMG = aaa.GetMg() doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_CHANGE, xxx) xxx.SetMg((bMG+aMG)/2) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main() Just like you do basic average :)
  19. Since it's part of MAXON code source I doubt you will have precise answerd. But this is common noise type and with a bit of googleing you will be able to get them. https://aftbit.com/cell-noise-2/ https://thebookofshaders.com/11/ http://graphics.cs.kuleuven.be/publications/LLCDDELPZ10STARPNF/ Or maybe you can do some matehmatical reversing stuff since you can generate trhought python any type of noise with given parameter. SO you know the result, you know x,y,z, you just have to found the equation who lead to thoes results.
  20. Pickwalk is just a tool who make active selection according the arrow key pressed. Is not what my plugin is done. But you got one from Bret who do that I guess. https://www.cineversity.com/vidplaylist/pickwalker_plugin_and_pickwalk_scripts If features is missing in his plugin just ask maybe I will develop one. Since it's pretty easy to do. But again I think the one made by Bret is what you are looking for.
  21. New udpdate And R15+ https://gumroad.com/products/nhxEC Fixed bug snapped object is in rotation point was set badly. @bentraje Don't really know what is PickWalk but I have made this plugin which is kind of pickWalk (but I can make some mistake I don't really know what is it ^^') http://frenchcinema4d.fr/showthread.php?80871-EasyNavigation
  22. I don't really understand what you want to achieve. But two thing that can help you. Color are Vector. Condition node return a Bollean(0 or 1) if you want to make a substraction. You have to create a vector. Basicly you could use FloatToVector (link the boolean to X,Y,Z) then you have a Vector representation of your bollean. After it be sure to set the math node to Vector type. And you should be able to link those value. But as said I don't understand what you want to achieve. I jsut understand why it's not working :p Hope it's help you
  23. Yes but you need mograph an way more step. It's not something like when you set the spline to uniform cause uniform only distribute point beetween existant point. My plugin will change all points for getting something even. Here is just a a shift click on the spline ;) But yes with a mospline you can do this but it's maybe why it's a free plugin.
  24. Hello everyone. I pressent you my new plugin Spline Resampler. If you are a Houdini user it's a generator plugin which simulate the resample node you get into Houdini. For other peoples who don't know the resample node, it allow you to distribute evently points into a given spline. It can be very usefull for animation or modeling. It's free and aviable in gumroad https://gum.co/JwVDT Compatibility : MAC / WIN for R16.021+ only.
  25. Here is an old script I did that press the # Record Active Objects button each frame. import c4d def main(): fps = doc.GetFps() #get fps number frame = 0 #set the start frame maxFrame = doc.GetLoopMaxTime().GetFrame(fps) #get all frame #For each frame while frame != maxFrame+1: doc.SetTime(c4d.BaseTime(frame,fps))#change time c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)#ask to redraw the view c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)#send message to c4d we have change the time c4d.CallCommand(12410)#press Record Active Objects frame += 1#define the next frame c4d.EventAdd()#Update scene if __name__=='__main__': main() Then basicly what is interested you is : doc.SetTime(c4d.BaseTime(frame,fps))#change time c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW)#ask to redraw the view c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)#send message to c4d we have change the time As said before take care of ExecutePass since it re-calcul everything in the scene.
×
×
  • Create New...