Create a plane and apply ocean modifier to it

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












I've been trying this a bunch of ways but no matter what I do I get a blank white plane. What I want is to programmatically create a plane with the ocean modifier applied to it. What am I missing?



bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))
for obj in bpy.data.objects:
obj.select = False
plane = bpy.data.objects['Plane']
plane.select = True
bpy.context.scene.objects.active = plane
bpy.ops.object.modifier_apply(modifier='Ocean')









share|improve this question









New contributor




Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    2
    down vote

    favorite












    I've been trying this a bunch of ways but no matter what I do I get a blank white plane. What I want is to programmatically create a plane with the ocean modifier applied to it. What am I missing?



    bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
    bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))
    for obj in bpy.data.objects:
    obj.select = False
    plane = bpy.data.objects['Plane']
    plane.select = True
    bpy.context.scene.objects.active = plane
    bpy.ops.object.modifier_apply(modifier='Ocean')









    share|improve this question









    New contributor




    Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I've been trying this a bunch of ways but no matter what I do I get a blank white plane. What I want is to programmatically create a plane with the ocean modifier applied to it. What am I missing?



      bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
      bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))
      for obj in bpy.data.objects:
      obj.select = False
      plane = bpy.data.objects['Plane']
      plane.select = True
      bpy.context.scene.objects.active = plane
      bpy.ops.object.modifier_apply(modifier='Ocean')









      share|improve this question









      New contributor




      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I've been trying this a bunch of ways but no matter what I do I get a blank white plane. What I want is to programmatically create a plane with the ocean modifier applied to it. What am I missing?



      bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
      bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))
      for obj in bpy.data.objects:
      obj.select = False
      plane = bpy.data.objects['Plane']
      plane.select = True
      bpy.context.scene.objects.active = plane
      bpy.ops.object.modifier_apply(modifier='Ocean')






      python ocean-simulation






      share|improve this question









      New contributor




      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 3 hours ago





















      New contributor




      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      Sam Johnson

      133




      133




      New contributor




      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Sam Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You need to add the ocean modifier before you can 'Apply' it. Try :



          import bpy

          model_height = 2

          bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
          bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))

          for obj in bpy.data.objects:
          obj.select = False

          plane = bpy.data.objects['Plane']
          plane.select = True
          bpy.context.scene.objects.active = plane

          #Add the modifier
          bpy.ops.object.modifier_add(type='OCEAN')

          #Apply the modifier
          bpy.ops.object.modifier_apply(modifier='Ocean')


          Obviously, if you want to adjust the Ocean modifier you'll need to do this before 'apply'ing it (or don't apply it and leave it on the modifier stack).






          share|improve this answer
















          • 3




            @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
            – batFINGER
            2 hours ago











          • @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
            – Rich Sedman
            2 hours ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "502"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Sam Johnson is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f120103%2fcreate-a-plane-and-apply-ocean-modifier-to-it%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          You need to add the ocean modifier before you can 'Apply' it. Try :



          import bpy

          model_height = 2

          bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
          bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))

          for obj in bpy.data.objects:
          obj.select = False

          plane = bpy.data.objects['Plane']
          plane.select = True
          bpy.context.scene.objects.active = plane

          #Add the modifier
          bpy.ops.object.modifier_add(type='OCEAN')

          #Apply the modifier
          bpy.ops.object.modifier_apply(modifier='Ocean')


          Obviously, if you want to adjust the Ocean modifier you'll need to do this before 'apply'ing it (or don't apply it and leave it on the modifier stack).






          share|improve this answer
















          • 3




            @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
            – batFINGER
            2 hours ago











          • @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
            – Rich Sedman
            2 hours ago














          up vote
          3
          down vote



          accepted










          You need to add the ocean modifier before you can 'Apply' it. Try :



          import bpy

          model_height = 2

          bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
          bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))

          for obj in bpy.data.objects:
          obj.select = False

          plane = bpy.data.objects['Plane']
          plane.select = True
          bpy.context.scene.objects.active = plane

          #Add the modifier
          bpy.ops.object.modifier_add(type='OCEAN')

          #Apply the modifier
          bpy.ops.object.modifier_apply(modifier='Ocean')


          Obviously, if you want to adjust the Ocean modifier you'll need to do this before 'apply'ing it (or don't apply it and leave it on the modifier stack).






          share|improve this answer
















          • 3




            @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
            – batFINGER
            2 hours ago











          • @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
            – Rich Sedman
            2 hours ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          You need to add the ocean modifier before you can 'Apply' it. Try :



          import bpy

          model_height = 2

          bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
          bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))

          for obj in bpy.data.objects:
          obj.select = False

          plane = bpy.data.objects['Plane']
          plane.select = True
          bpy.context.scene.objects.active = plane

          #Add the modifier
          bpy.ops.object.modifier_add(type='OCEAN')

          #Apply the modifier
          bpy.ops.object.modifier_apply(modifier='Ocean')


          Obviously, if you want to adjust the Ocean modifier you'll need to do this before 'apply'ing it (or don't apply it and leave it on the modifier stack).






          share|improve this answer












          You need to add the ocean modifier before you can 'Apply' it. Try :



          import bpy

          model_height = 2

          bpy.ops.mesh.primitive_plane_add(radius=10, view_align=False, location=(0, 0, 0))
          bpy.ops.transform.translate(value=(0,0,-1.0 * model_height / 2.0 + 0.2 * model_height))

          for obj in bpy.data.objects:
          obj.select = False

          plane = bpy.data.objects['Plane']
          plane.select = True
          bpy.context.scene.objects.active = plane

          #Add the modifier
          bpy.ops.object.modifier_add(type='OCEAN')

          #Apply the modifier
          bpy.ops.object.modifier_apply(modifier='Ocean')


          Obviously, if you want to adjust the Ocean modifier you'll need to do this before 'apply'ing it (or don't apply it and leave it on the modifier stack).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          Rich Sedman

          20k23998




          20k23998







          • 3




            @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
            – batFINGER
            2 hours ago











          • @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
            – Rich Sedman
            2 hours ago












          • 3




            @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
            – batFINGER
            2 hours ago











          • @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
            – Rich Sedman
            2 hours ago







          3




          3




          @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
          – batFINGER
          2 hours ago





          @SamJohnson Often simpler to add modifier with om = plane.modifiers.new("SomeName", 'OCEAN') Set props om.wind_velocity = 10.0 and apply with operator bpy.ops.object.modifier_apply(modifier=om.name) Similarly pick up a newly added primitive ref directly after operator with plane = context.object (will be the active object and selected) Avoid expecting the name to be "Plane". Script above only ever applies modifier to original plane if re-run.
          – batFINGER
          2 hours ago













          @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
          – Rich Sedman
          2 hours ago




          @batFINGER Very worthwhile comments (as always). Feel free to add an answer or edit - you could do this far more justice than I can.
          – Rich Sedman
          2 hours ago










          Sam Johnson is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Sam Johnson is a new contributor. Be nice, and check out our Code of Conduct.












          Sam Johnson is a new contributor. Be nice, and check out our Code of Conduct.











          Sam Johnson is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f120103%2fcreate-a-plane-and-apply-ocean-modifier-to-it%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery